mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Improve directory handling in `app_params()
`
This commit is contained in:
parent
17b8241585
commit
d24ffe2949
@ -73,8 +73,8 @@ def app_params(
|
||||
request: Any,
|
||||
test_params: dict[str, Any],
|
||||
shared_result: SharedResult,
|
||||
sphinx_test_tempdir: str,
|
||||
rootdir: Path,
|
||||
sphinx_test_tempdir: Path,
|
||||
rootdir: Path | None,
|
||||
) -> _app_params:
|
||||
"""Parameters that are specified by 'pytest.mark.sphinx' for
|
||||
sphinx.application.Sphinx initialization
|
||||
@ -102,13 +102,17 @@ def app_params(
|
||||
|
||||
# ##### prepare Application params
|
||||
|
||||
testroot = kwargs.pop('testroot', 'root')
|
||||
kwargs['srcdir'] = srcdir = sphinx_test_tempdir / kwargs.get('srcdir', testroot)
|
||||
test_root = kwargs.pop('testroot', 'root')
|
||||
kwargs['srcdir'] = srcdir = sphinx_test_tempdir / kwargs.get('srcdir', test_root)
|
||||
|
||||
# special support for sphinx/tests
|
||||
if rootdir and not srcdir.exists():
|
||||
testroot_path = rootdir / ('test-' + testroot)
|
||||
shutil.copytree(testroot_path, srcdir)
|
||||
if rootdir is not None:
|
||||
test_root_path = rootdir / f'test-{test_root}'
|
||||
if test_root_path.is_dir() and not srcdir.exists():
|
||||
shutil.copytree(test_root_path, srcdir)
|
||||
|
||||
# always write to the temporary directory
|
||||
kwargs.setdefault('builddir', srcdir / '_build')
|
||||
|
||||
return _app_params(args, kwargs)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user