From 5310f4c53394a2ab78fab3763c6c57095da201cf Mon Sep 17 00:00:00 2001 From: David Foster Date: Sun, 22 Oct 2023 20:19:57 +0100 Subject: [PATCH 1/6] Add testing for python 3.11 and 3.12 --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index fa22922..59ca049 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.9", "3.10"] + python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v2 From 19b0b0726a7defac56df0f2291b0a278e670311b Mon Sep 17 00:00:00 2001 From: David Foster Date: Sun, 22 Oct 2023 20:27:50 +0100 Subject: [PATCH 2/6] Allow teting against python 3.12 pre-release --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 59ca049..69ad18c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,6 +28,7 @@ jobs: uses: actions/setup-python@v1 with: python-version: ${{ matrix.python-version }} + allow-prereleases: true - name: Install dependencies run: | python -m pip install --upgrade pip From 53e71c38e0ec0e9937dad4c1c798bdb6434ed871 Mon Sep 17 00:00:00 2001 From: David Foster Date: Sun, 22 Oct 2023 20:29:36 +0100 Subject: [PATCH 3/6] Upgrade python setup action version --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 69ad18c..a6236e4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -25,7 +25,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} allow-prereleases: true From 309f35571c4fe672cd6df59bdf7344e67ff41ffd Mon Sep 17 00:00:00 2001 From: David Foster Date: Sun, 22 Oct 2023 20:49:08 +0100 Subject: [PATCH 4/6] Remove depreciated sphinx_testing dependency --- setup.py | 1 - sphinx_tabs/tabs.py | 6 +++--- tests/conftest.py | 8 +++----- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/setup.py b/setup.py index ba91c96..e5a7198 100755 --- a/setup.py +++ b/setup.py @@ -33,7 +33,6 @@ def get_version(): "pytest-cov", "pytest-regressions", "pygments", - "sphinx_testing", "bs4", "rinohtype", ], diff --git a/sphinx_tabs/tabs.py b/sphinx_tabs/tabs.py index 2fc7653..b7afd09 100644 --- a/sphinx_tabs/tabs.py +++ b/sphinx_tabs/tabs.py @@ -328,12 +328,12 @@ def update_context(app, pagename, templatename, context, doctree): context["css_files"][:] = context["css_files"] for path in paths: if path.suffix == ".css" and path in context["css_files"]: - context["css_files"].remove(path.as_posix()) + context["css_files"].remove(path.filename) if "script_files" in context: context["script_files"][:] = context["script_files"] for path in paths: - if path.suffix == ".js" and path.as_posix() in context["script_files"]: - context["script_files"].remove(path.as_posix()) + if path.suffix == ".js" and path.filename in context["script_files"]: + context["script_files"].remove(path.filename) # pylint: enable=unused-argument diff --git a/tests/conftest.py b/tests/conftest.py index f776f49..29faa0d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -3,12 +3,10 @@ from pathlib import Path from bs4 import BeautifulSoup import sphinx -from sphinx.testing.path import path from sphinx_tabs.tabs import FILES -pytest_plugins = "sphinx.testing.fixtures" - +pytest_plugins = 'sphinx.testing.fixtures' def pytest_configure(config): config.addinivalue_line( @@ -19,7 +17,7 @@ def pytest_configure(config): @pytest.fixture(scope="session") def rootdir(): """Pytest uses this to find test documents.""" - return path(__file__).parent.abspath() / "roots" + return Path(__file__).parent.absolute() / "roots" @pytest.fixture(autouse=True) @@ -117,7 +115,7 @@ def read(app, docname="index", resolve=False, regress=False, replace=None): extension = ".xml" # convert absolute filenames - for node in doctree.traverse(lambda n: "source" in n): + for node in doctree.findall(lambda n: "source" in n): node["source"] = Path(node["source"]).name if regress: From 762dcf5dcbd8e11bc1811c45bc4a394da2662978 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 22 Oct 2023 19:49:38 +0000 Subject: [PATCH 5/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/conftest.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 29faa0d..e6d450a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -6,7 +6,8 @@ from sphinx_tabs.tabs import FILES -pytest_plugins = 'sphinx.testing.fixtures' +pytest_plugins = "sphinx.testing.fixtures" + def pytest_configure(config): config.addinivalue_line( From 1cd64e0d5b7eaf1a8f56ee8df2895eb4426e57c9 Mon Sep 17 00:00:00 2001 From: David Foster Date: Sun, 22 Oct 2023 20:58:29 +0100 Subject: [PATCH 6/6] Revert change in path comparison --- sphinx_tabs/tabs.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sphinx_tabs/tabs.py b/sphinx_tabs/tabs.py index b7afd09..2fc7653 100644 --- a/sphinx_tabs/tabs.py +++ b/sphinx_tabs/tabs.py @@ -328,12 +328,12 @@ def update_context(app, pagename, templatename, context, doctree): context["css_files"][:] = context["css_files"] for path in paths: if path.suffix == ".css" and path in context["css_files"]: - context["css_files"].remove(path.filename) + context["css_files"].remove(path.as_posix()) if "script_files" in context: context["script_files"][:] = context["script_files"] for path in paths: - if path.suffix == ".js" and path.filename in context["script_files"]: - context["script_files"].remove(path.filename) + if path.suffix == ".js" and path.as_posix() in context["script_files"]: + context["script_files"].remove(path.as_posix()) # pylint: enable=unused-argument