From 74ec2204795481402322e75752547571a553cc4e Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Tue, 7 Jan 2025 10:57:09 +0000 Subject: [PATCH] apidoc: Rename test roots --- .../_templates/module.rst.jinja | 0 .../_templates/module.rst_t | 0 .../_templates/package.rst_t | 0 .../mypackage/__init__.py | 0 .../mypackage/mymodule.py | 0 .../halibut.cpython-38-x86_64-linux-gnu.so | 0 .../fish_licence/halibut.pyx | 0 .../a/b/c/__init__.py | 0 .../a/b/c/d.py | 0 .../a/b/e/__init__.py | 0 .../a/b/e/f.py | 0 .../a/b/x/y.py | 0 .../parent/__init__.py | 0 .../parent/child/__init__.py | 0 .../parent/child/foo.py | 0 .../mypackage/__init__.py | 0 .../mypackage/main.py | 0 .../mypackage/no_init/foo.py | 0 .../mypackage/resource/__init__.py | 0 .../mypackage/resource/resource.txt | 0 .../mypackage/something/__init__.py | 0 .../package_/__init__.py | 0 .../package_/module_.py | 0 .../conf.py | 0 .../dummy_module.py | 0 .../index.rst | 0 .../sphinx.rst | 0 .../underscore_module_.py | 0 tests/test_extensions/test_ext_apidoc.py | 30 +++++++++---------- tests/test_extensions/test_ext_autosummary.py | 18 +++++++++-- 30 files changed, 30 insertions(+), 18 deletions(-) rename tests/roots/{test-apidoc-custom-templates => test-ext-apidoc-custom-templates}/_templates/module.rst.jinja (100%) rename tests/roots/{test-apidoc-custom-templates => test-ext-apidoc-custom-templates}/_templates/module.rst_t (100%) rename tests/roots/{test-apidoc-custom-templates => test-ext-apidoc-custom-templates}/_templates/package.rst_t (100%) rename tests/roots/{test-apidoc-custom-templates => test-ext-apidoc-custom-templates}/mypackage/__init__.py (100%) rename tests/roots/{test-apidoc-custom-templates => test-ext-apidoc-custom-templates}/mypackage/mymodule.py (100%) rename tests/roots/{test-apidoc-duplicates => test-ext-apidoc-duplicates}/fish_licence/halibut.cpython-38-x86_64-linux-gnu.so (100%) rename tests/roots/{test-apidoc-duplicates => test-ext-apidoc-duplicates}/fish_licence/halibut.pyx (100%) rename tests/roots/{test-apidoc-pep420 => test-ext-apidoc-pep420}/a/b/c/__init__.py (100%) rename tests/roots/{test-apidoc-pep420 => test-ext-apidoc-pep420}/a/b/c/d.py (100%) rename tests/roots/{test-apidoc-pep420 => test-ext-apidoc-pep420}/a/b/e/__init__.py (100%) rename tests/roots/{test-apidoc-pep420 => test-ext-apidoc-pep420}/a/b/e/f.py (100%) rename tests/roots/{test-apidoc-pep420 => test-ext-apidoc-pep420}/a/b/x/y.py (100%) rename tests/roots/{test-apidoc-subpackage-in-toc => test-ext-apidoc-subpackage-in-toc}/parent/__init__.py (100%) rename tests/roots/{test-apidoc-subpackage-in-toc => test-ext-apidoc-subpackage-in-toc}/parent/child/__init__.py (100%) rename tests/roots/{test-apidoc-subpackage-in-toc => test-ext-apidoc-subpackage-in-toc}/parent/child/foo.py (100%) rename tests/roots/{test-apidoc-toc => test-ext-apidoc-toc}/mypackage/__init__.py (100%) rename tests/roots/{test-apidoc-toc => test-ext-apidoc-toc}/mypackage/main.py (100%) rename tests/roots/{test-apidoc-toc => test-ext-apidoc-toc}/mypackage/no_init/foo.py (100%) rename tests/roots/{test-apidoc-toc => test-ext-apidoc-toc}/mypackage/resource/__init__.py (100%) rename tests/roots/{test-apidoc-toc => test-ext-apidoc-toc}/mypackage/resource/resource.txt (100%) rename tests/roots/{test-apidoc-toc => test-ext-apidoc-toc}/mypackage/something/__init__.py (100%) rename tests/roots/{test-apidoc-trailing-underscore => test-ext-apidoc-trailing-underscore}/package_/__init__.py (100%) rename tests/roots/{test-apidoc-trailing-underscore => test-ext-apidoc-trailing-underscore}/package_/module_.py (100%) rename tests/roots/{test-autosummary => test-ext-autosummary-ext}/conf.py (100%) rename tests/roots/{test-autosummary => test-ext-autosummary-ext}/dummy_module.py (100%) rename tests/roots/{test-autosummary => test-ext-autosummary-ext}/index.rst (100%) rename tests/roots/{test-autosummary => test-ext-autosummary-ext}/sphinx.rst (100%) rename tests/roots/{test-autosummary => test-ext-autosummary-ext}/underscore_module_.py (100%) diff --git a/tests/roots/test-apidoc-custom-templates/_templates/module.rst.jinja b/tests/roots/test-ext-apidoc-custom-templates/_templates/module.rst.jinja similarity index 100% rename from tests/roots/test-apidoc-custom-templates/_templates/module.rst.jinja rename to tests/roots/test-ext-apidoc-custom-templates/_templates/module.rst.jinja diff --git a/tests/roots/test-apidoc-custom-templates/_templates/module.rst_t b/tests/roots/test-ext-apidoc-custom-templates/_templates/module.rst_t similarity index 100% rename from tests/roots/test-apidoc-custom-templates/_templates/module.rst_t rename to tests/roots/test-ext-apidoc-custom-templates/_templates/module.rst_t diff --git a/tests/roots/test-apidoc-custom-templates/_templates/package.rst_t b/tests/roots/test-ext-apidoc-custom-templates/_templates/package.rst_t similarity index 100% rename from tests/roots/test-apidoc-custom-templates/_templates/package.rst_t rename to tests/roots/test-ext-apidoc-custom-templates/_templates/package.rst_t diff --git a/tests/roots/test-apidoc-custom-templates/mypackage/__init__.py b/tests/roots/test-ext-apidoc-custom-templates/mypackage/__init__.py similarity index 100% rename from tests/roots/test-apidoc-custom-templates/mypackage/__init__.py rename to tests/roots/test-ext-apidoc-custom-templates/mypackage/__init__.py diff --git a/tests/roots/test-apidoc-custom-templates/mypackage/mymodule.py b/tests/roots/test-ext-apidoc-custom-templates/mypackage/mymodule.py similarity index 100% rename from tests/roots/test-apidoc-custom-templates/mypackage/mymodule.py rename to tests/roots/test-ext-apidoc-custom-templates/mypackage/mymodule.py diff --git a/tests/roots/test-apidoc-duplicates/fish_licence/halibut.cpython-38-x86_64-linux-gnu.so b/tests/roots/test-ext-apidoc-duplicates/fish_licence/halibut.cpython-38-x86_64-linux-gnu.so similarity index 100% rename from tests/roots/test-apidoc-duplicates/fish_licence/halibut.cpython-38-x86_64-linux-gnu.so rename to tests/roots/test-ext-apidoc-duplicates/fish_licence/halibut.cpython-38-x86_64-linux-gnu.so diff --git a/tests/roots/test-apidoc-duplicates/fish_licence/halibut.pyx b/tests/roots/test-ext-apidoc-duplicates/fish_licence/halibut.pyx similarity index 100% rename from tests/roots/test-apidoc-duplicates/fish_licence/halibut.pyx rename to tests/roots/test-ext-apidoc-duplicates/fish_licence/halibut.pyx diff --git a/tests/roots/test-apidoc-pep420/a/b/c/__init__.py b/tests/roots/test-ext-apidoc-pep420/a/b/c/__init__.py similarity index 100% rename from tests/roots/test-apidoc-pep420/a/b/c/__init__.py rename to tests/roots/test-ext-apidoc-pep420/a/b/c/__init__.py diff --git a/tests/roots/test-apidoc-pep420/a/b/c/d.py b/tests/roots/test-ext-apidoc-pep420/a/b/c/d.py similarity index 100% rename from tests/roots/test-apidoc-pep420/a/b/c/d.py rename to tests/roots/test-ext-apidoc-pep420/a/b/c/d.py diff --git a/tests/roots/test-apidoc-pep420/a/b/e/__init__.py b/tests/roots/test-ext-apidoc-pep420/a/b/e/__init__.py similarity index 100% rename from tests/roots/test-apidoc-pep420/a/b/e/__init__.py rename to tests/roots/test-ext-apidoc-pep420/a/b/e/__init__.py diff --git a/tests/roots/test-apidoc-pep420/a/b/e/f.py b/tests/roots/test-ext-apidoc-pep420/a/b/e/f.py similarity index 100% rename from tests/roots/test-apidoc-pep420/a/b/e/f.py rename to tests/roots/test-ext-apidoc-pep420/a/b/e/f.py diff --git a/tests/roots/test-apidoc-pep420/a/b/x/y.py b/tests/roots/test-ext-apidoc-pep420/a/b/x/y.py similarity index 100% rename from tests/roots/test-apidoc-pep420/a/b/x/y.py rename to tests/roots/test-ext-apidoc-pep420/a/b/x/y.py diff --git a/tests/roots/test-apidoc-subpackage-in-toc/parent/__init__.py b/tests/roots/test-ext-apidoc-subpackage-in-toc/parent/__init__.py similarity index 100% rename from tests/roots/test-apidoc-subpackage-in-toc/parent/__init__.py rename to tests/roots/test-ext-apidoc-subpackage-in-toc/parent/__init__.py diff --git a/tests/roots/test-apidoc-subpackage-in-toc/parent/child/__init__.py b/tests/roots/test-ext-apidoc-subpackage-in-toc/parent/child/__init__.py similarity index 100% rename from tests/roots/test-apidoc-subpackage-in-toc/parent/child/__init__.py rename to tests/roots/test-ext-apidoc-subpackage-in-toc/parent/child/__init__.py diff --git a/tests/roots/test-apidoc-subpackage-in-toc/parent/child/foo.py b/tests/roots/test-ext-apidoc-subpackage-in-toc/parent/child/foo.py similarity index 100% rename from tests/roots/test-apidoc-subpackage-in-toc/parent/child/foo.py rename to tests/roots/test-ext-apidoc-subpackage-in-toc/parent/child/foo.py diff --git a/tests/roots/test-apidoc-toc/mypackage/__init__.py b/tests/roots/test-ext-apidoc-toc/mypackage/__init__.py similarity index 100% rename from tests/roots/test-apidoc-toc/mypackage/__init__.py rename to tests/roots/test-ext-apidoc-toc/mypackage/__init__.py diff --git a/tests/roots/test-apidoc-toc/mypackage/main.py b/tests/roots/test-ext-apidoc-toc/mypackage/main.py similarity index 100% rename from tests/roots/test-apidoc-toc/mypackage/main.py rename to tests/roots/test-ext-apidoc-toc/mypackage/main.py diff --git a/tests/roots/test-apidoc-toc/mypackage/no_init/foo.py b/tests/roots/test-ext-apidoc-toc/mypackage/no_init/foo.py similarity index 100% rename from tests/roots/test-apidoc-toc/mypackage/no_init/foo.py rename to tests/roots/test-ext-apidoc-toc/mypackage/no_init/foo.py diff --git a/tests/roots/test-apidoc-toc/mypackage/resource/__init__.py b/tests/roots/test-ext-apidoc-toc/mypackage/resource/__init__.py similarity index 100% rename from tests/roots/test-apidoc-toc/mypackage/resource/__init__.py rename to tests/roots/test-ext-apidoc-toc/mypackage/resource/__init__.py diff --git a/tests/roots/test-apidoc-toc/mypackage/resource/resource.txt b/tests/roots/test-ext-apidoc-toc/mypackage/resource/resource.txt similarity index 100% rename from tests/roots/test-apidoc-toc/mypackage/resource/resource.txt rename to tests/roots/test-ext-apidoc-toc/mypackage/resource/resource.txt diff --git a/tests/roots/test-apidoc-toc/mypackage/something/__init__.py b/tests/roots/test-ext-apidoc-toc/mypackage/something/__init__.py similarity index 100% rename from tests/roots/test-apidoc-toc/mypackage/something/__init__.py rename to tests/roots/test-ext-apidoc-toc/mypackage/something/__init__.py diff --git a/tests/roots/test-apidoc-trailing-underscore/package_/__init__.py b/tests/roots/test-ext-apidoc-trailing-underscore/package_/__init__.py similarity index 100% rename from tests/roots/test-apidoc-trailing-underscore/package_/__init__.py rename to tests/roots/test-ext-apidoc-trailing-underscore/package_/__init__.py diff --git a/tests/roots/test-apidoc-trailing-underscore/package_/module_.py b/tests/roots/test-ext-apidoc-trailing-underscore/package_/module_.py similarity index 100% rename from tests/roots/test-apidoc-trailing-underscore/package_/module_.py rename to tests/roots/test-ext-apidoc-trailing-underscore/package_/module_.py diff --git a/tests/roots/test-autosummary/conf.py b/tests/roots/test-ext-autosummary-ext/conf.py similarity index 100% rename from tests/roots/test-autosummary/conf.py rename to tests/roots/test-ext-autosummary-ext/conf.py diff --git a/tests/roots/test-autosummary/dummy_module.py b/tests/roots/test-ext-autosummary-ext/dummy_module.py similarity index 100% rename from tests/roots/test-autosummary/dummy_module.py rename to tests/roots/test-ext-autosummary-ext/dummy_module.py diff --git a/tests/roots/test-autosummary/index.rst b/tests/roots/test-ext-autosummary-ext/index.rst similarity index 100% rename from tests/roots/test-autosummary/index.rst rename to tests/roots/test-ext-autosummary-ext/index.rst diff --git a/tests/roots/test-autosummary/sphinx.rst b/tests/roots/test-ext-autosummary-ext/sphinx.rst similarity index 100% rename from tests/roots/test-autosummary/sphinx.rst rename to tests/roots/test-ext-autosummary-ext/sphinx.rst diff --git a/tests/roots/test-autosummary/underscore_module_.py b/tests/roots/test-ext-autosummary-ext/underscore_module_.py similarity index 100% rename from tests/roots/test-autosummary/underscore_module_.py rename to tests/roots/test-ext-autosummary-ext/underscore_module_.py diff --git a/tests/test_extensions/test_ext_apidoc.py b/tests/test_extensions/test_ext_apidoc.py index b70c46d2fb3..61550bea529 100644 --- a/tests/test_extensions/test_ext_apidoc.py +++ b/tests/test_extensions/test_ext_apidoc.py @@ -60,10 +60,10 @@ def test_simple(make_app, apidoc): @pytest.mark.apidoc( - coderoot='test-apidoc-custom-templates', + coderoot='test-ext-apidoc-custom-templates', options=[ '--separate', - '--templatedir=tests/roots/test-apidoc-custom-templates/_templates', + '--templatedir=tests/roots/test-ext-apidoc-custom-templates/_templates', ], ) def test_custom_templates(make_app, apidoc): @@ -95,7 +95,7 @@ def test_custom_templates(make_app, apidoc): @pytest.mark.apidoc( - coderoot='test-apidoc-pep420/a', + coderoot='test-ext-apidoc-pep420/a', options=['--implicit-namespaces'], ) def test_pep_0420_enabled(make_app, apidoc): @@ -143,7 +143,7 @@ def test_pep_0420_enabled(make_app, apidoc): @pytest.mark.apidoc( - coderoot='test-apidoc-pep420/a', + coderoot='test-ext-apidoc-pep420/a', options=['--implicit-namespaces', '--separate'], ) def test_pep_0420_enabled_separate(make_app, apidoc): @@ -192,7 +192,7 @@ def test_pep_0420_enabled_separate(make_app, apidoc): assert 'a.b.x namespace\n' in txt -@pytest.mark.apidoc(coderoot='test-apidoc-pep420/a') +@pytest.mark.apidoc(coderoot='test-ext-apidoc-pep420/a') def test_pep_0420_disabled(make_app, apidoc): outdir = apidoc.outdir assert (outdir / 'conf.py').is_file() @@ -205,7 +205,7 @@ def test_pep_0420_disabled(make_app, apidoc): print(app._warning.getvalue()) -@pytest.mark.apidoc(coderoot='test-apidoc-pep420/a/b') +@pytest.mark.apidoc(coderoot='test-ext-apidoc-pep420/a/b') def test_pep_0420_disabled_top_level_verify(make_app, apidoc): outdir = apidoc.outdir assert (outdir / 'conf.py').is_file() @@ -224,7 +224,7 @@ def test_pep_0420_disabled_top_level_verify(make_app, apidoc): print(app._warning.getvalue()) -@pytest.mark.apidoc(coderoot='test-apidoc-trailing-underscore') +@pytest.mark.apidoc(coderoot='test-ext-apidoc-trailing-underscore') def test_trailing_underscore(make_app, apidoc): outdir = apidoc.outdir assert (outdir / 'conf.py').is_file() @@ -243,7 +243,7 @@ def test_trailing_underscore(make_app, apidoc): @pytest.mark.apidoc( - coderoot='test-apidoc-pep420/a', + coderoot='test-ext-apidoc-pep420/a', excludes=['b/c/d.py', 'b/e/f.py', 'b/e/__init__.py'], options=['--implicit-namespaces', '--separate'], ) @@ -261,7 +261,7 @@ def test_excludes(apidoc): @pytest.mark.apidoc( - coderoot='test-apidoc-pep420/a', + coderoot='test-ext-apidoc-pep420/a', excludes=['b/e'], options=['--implicit-namespaces', '--separate'], ) @@ -278,7 +278,7 @@ def test_excludes_subpackage_should_be_skipped(apidoc): @pytest.mark.apidoc( - coderoot='test-apidoc-pep420/a', + coderoot='test-ext-apidoc-pep420/a', excludes=['b/e/f.py'], options=['--implicit-namespaces', '--separate'], ) @@ -295,7 +295,7 @@ def test_excludes_module_should_be_skipped(apidoc): @pytest.mark.apidoc( - coderoot='test-apidoc-pep420/a', + coderoot='test-ext-apidoc-pep420/a', excludes=[], options=['--implicit-namespaces', '--separate'], ) @@ -353,7 +353,7 @@ def test_extension_parsed(apidoc): @pytest.mark.apidoc( - coderoot='test-apidoc-toc/mypackage', + coderoot='test-ext-apidoc-toc/mypackage', options=['--implicit-namespaces'], ) def test_toc_all_references_should_exist_pep420_enabled(apidoc): @@ -385,7 +385,7 @@ def test_toc_all_references_should_exist_pep420_enabled(apidoc): @pytest.mark.apidoc( - coderoot='test-apidoc-toc/mypackage', + coderoot='test-ext-apidoc-toc/mypackage', ) def test_toc_all_references_should_exist_pep420_disabled(apidoc): """All references in toc should exist. This test doesn't say if @@ -432,7 +432,7 @@ def extract_toc(path): @pytest.mark.apidoc( - coderoot='test-apidoc-subpackage-in-toc', + coderoot='test-ext-apidoc-subpackage-in-toc', options=['--separate'], ) def test_subpackage_in_toc(apidoc): @@ -733,7 +733,7 @@ def test_no_duplicates(rootdir, tmp_path): # Ensure test works on Windows sphinx.ext.apidoc._generate.PY_SUFFIXES += ('.so',) - package = rootdir / 'test-apidoc-duplicates' / 'fish_licence' + package = rootdir / 'test-ext-apidoc-duplicates' / 'fish_licence' outdir = tmp_path / 'out' apidoc_main(['-o', str(outdir), '-T', str(package), '--implicit-namespaces']) diff --git a/tests/test_extensions/test_ext_autosummary.py b/tests/test_extensions/test_ext_autosummary.py index 1b06b11d384..901edb29915 100644 --- a/tests/test_extensions/test_ext_autosummary.py +++ b/tests/test_extensions/test_ext_autosummary.py @@ -147,7 +147,11 @@ def test_extract_summary(capsys): assert err == '' -@pytest.mark.sphinx('dummy', testroot='autosummary', confoverrides=defaults.copy()) +@pytest.mark.sphinx( + 'dummy', + testroot='ext-autosummary-ext', + confoverrides=defaults.copy(), +) def test_get_items_summary(make_app, app_params): import sphinx.ext.autosummary import sphinx.ext.autosummary.generate @@ -219,7 +223,11 @@ def str_content(elem: Element) -> str: return ''.join(str_content(e) for e in elem) -@pytest.mark.sphinx('xml', testroot='autosummary', confoverrides=defaults.copy()) +@pytest.mark.sphinx( + 'xml', + testroot='ext-autosummary-ext', + confoverrides=defaults.copy(), +) def test_escaping(app): app.build(force_all=True) @@ -744,7 +752,11 @@ def test_autosummary_filename_map(app): assert html_warnings == '' -@pytest.mark.sphinx('latex', testroot='autosummary', confoverrides=defaults.copy()) +@pytest.mark.sphinx( + 'latex', + testroot='ext-autosummary-ext', + confoverrides=defaults.copy(), +) def test_autosummary_latex_table_colspec(app): app.build(force_all=True) result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')