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,
|
request: Any,
|
||||||
test_params: dict[str, Any],
|
test_params: dict[str, Any],
|
||||||
shared_result: SharedResult,
|
shared_result: SharedResult,
|
||||||
sphinx_test_tempdir: str,
|
sphinx_test_tempdir: Path,
|
||||||
rootdir: Path,
|
rootdir: Path | None,
|
||||||
) -> _app_params:
|
) -> _app_params:
|
||||||
"""Parameters that are specified by 'pytest.mark.sphinx' for
|
"""Parameters that are specified by 'pytest.mark.sphinx' for
|
||||||
sphinx.application.Sphinx initialization
|
sphinx.application.Sphinx initialization
|
||||||
@ -102,13 +102,17 @@ def app_params(
|
|||||||
|
|
||||||
# ##### prepare Application params
|
# ##### prepare Application params
|
||||||
|
|
||||||
testroot = kwargs.pop('testroot', 'root')
|
test_root = kwargs.pop('testroot', 'root')
|
||||||
kwargs['srcdir'] = srcdir = sphinx_test_tempdir / kwargs.get('srcdir', testroot)
|
kwargs['srcdir'] = srcdir = sphinx_test_tempdir / kwargs.get('srcdir', test_root)
|
||||||
|
|
||||||
# special support for sphinx/tests
|
# special support for sphinx/tests
|
||||||
if rootdir and not srcdir.exists():
|
if rootdir is not None:
|
||||||
testroot_path = rootdir / ('test-' + testroot)
|
test_root_path = rootdir / f'test-{test_root}'
|
||||||
shutil.copytree(testroot_path, srcdir)
|
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)
|
return _app_params(args, kwargs)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user