From 9dfaa9a325dd38685e5f84157b598ef74ed48274 Mon Sep 17 00:00:00 2001 From: Chris Sewell Date: Thu, 27 Jul 2023 12:17:51 +0200 Subject: [PATCH] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20UPGRADE:=20sphinx>=3D5,<8?= =?UTF-8?q?=20(#148)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 35 ++++++++++------------------------- pyproject.toml | 6 +++--- tests/test_snippets.py | 26 ++++++++++++++++++-------- tox.ini | 6 +----- 4 files changed, 32 insertions(+), 41 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8cd7cc3..7bb04f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,12 +24,21 @@ jobs: tests: strategy: + fail-fast: false matrix: os: [ubuntu-latest] python-version: ["3.8", "3.9", "3.10", "3.11"] + sphinx-version: ["~=7.0"] include: + - os: ubuntu-latest + python-version: 3.8 + sphinx-version: "~=5.0" + - os: ubuntu-latest + python-version: 3.8 + sphinx-version: "~=6.0" - os: windows-latest python-version: 3.8 + sphinx-version: "~=7.0" runs-on: ${{ matrix.os }} @@ -43,7 +52,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -e .[testing] + pip install --upgrade "sphinx${{ matrix.sphinx-version }}" -e .[testing] - name: Run pytest run: | pytest --cov=sphinx_design --cov-report=xml --cov-report=term-missing @@ -56,29 +65,6 @@ jobs: file: ./coverage.xml fail_ci_if_error: true - tests-sphinx4: - - strategy: - matrix: - os: [ubuntu-latest] - python-version: ["3.8", "3.10"] - - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - cache: pip - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -e .[testing] sphinx~=4.5 - - name: Run pytest - run: pytest - docs-build-format: runs-on: ubuntu-latest @@ -108,7 +94,6 @@ jobs: needs: - pre-commit - tests - - tests-sphinx4 - docs-build-format runs-on: ubuntu-latest diff --git a/pyproject.toml b/pyproject.toml index ca32898..6008c5b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,7 +27,7 @@ classifiers = [ ] keywords = ["sphinx", "extension", "material design", "web components"] requires-python = ">=3.8" -dependencies = ["sphinx>=4,<7"] +dependencies = ["sphinx>=5,<8"] [project.urls] Homepage = "https://github.com/executablebooks/sphinx-design" @@ -35,9 +35,9 @@ Documentation = "https://sphinx-design.readthedocs.io" [project.optional-dependencies] code_style = ["pre-commit>=2.12,<4.0"] -rtd = ["myst-parser>=0.18.0,<2"] +rtd = ["myst-parser>=1,<3"] testing = [ - "myst-parser>=0.18.0,<2", + "myst-parser>=1,<3", "pytest~=7.1", "pytest-cov", "pytest-regressions", diff --git a/tests/test_snippets.py b/tests/test_snippets.py index 047cfb9..ee9e280 100644 --- a/tests/test_snippets.py +++ b/tests/test_snippets.py @@ -33,9 +33,10 @@ def test_snippets_rst( builder.src_path.joinpath("index.rst").write_text(content, encoding="utf8") write_assets(builder.src_path) builder.build() - pformat = builder.get_doctree("index").pformat() + doctree = builder.get_doctree("index", post_transforms=False) + doctree.attributes.pop("translation_progress", None) # added in sphinx 7.1 file_regression.check( - pformat, + doctree.pformat(), basename=f"snippet_pre_{path.name[:-len(path.suffix)]}", extension=".xml", encoding="utf8", @@ -56,8 +57,10 @@ def test_snippets_myst( builder.src_path.joinpath("index.md").write_text(content, encoding="utf8") write_assets(builder.src_path) builder.build() + doctree = builder.get_doctree("index", post_transforms=False) + doctree.attributes.pop("translation_progress", None) # added in sphinx 7.1 file_regression.check( - builder.get_doctree("index").pformat(), + doctree.pformat(), basename=f"snippet_pre_{path.name[:-len(path.suffix)]}", extension=".xml", encoding="utf8", @@ -78,9 +81,10 @@ def test_snippets_rst_post( builder.src_path.joinpath("index.rst").write_text(content, encoding="utf8") write_assets(builder.src_path) builder.build() - pformat = builder.get_doctree("index", post_transforms=True).pformat() + doctree = builder.get_doctree("index", post_transforms=True) + doctree.attributes.pop("translation_progress", None) # added in sphinx 7.1 file_regression.check( - pformat, + doctree.pformat(), basename=f"snippet_post_{path.name[:-len(path.suffix)]}", extension=".xml", encoding="utf8", @@ -101,8 +105,10 @@ def test_snippets_myst_post( builder.src_path.joinpath("index.md").write_text(content, encoding="utf8") write_assets(builder.src_path) builder.build() + doctree = builder.get_doctree("index", post_transforms=True) + doctree.attributes.pop("translation_progress", None) # added in sphinx 7.1 file_regression.check( - builder.get_doctree("index", post_transforms=True).pformat(), + doctree.pformat(), basename=f"snippet_post_{path.name[:-len(path.suffix)]}", extension=".xml", encoding="utf8", @@ -117,8 +123,10 @@ def test_sd_hide_title_rst( content = ":sd_hide_title:\n\nHeading\n-------\n\ncontent" builder.src_path.joinpath("index.rst").write_text(content, encoding="utf8") builder.build() + doctree = builder.get_doctree("index", post_transforms=False) + doctree.attributes.pop("translation_progress", None) # added in sphinx 7.1 file_regression.check( - builder.get_doctree("index", post_transforms=False).pformat(), + doctree.pformat(), basename="sd_hide_title", extension=".xml", encoding="utf8", @@ -133,8 +141,10 @@ def test_sd_hide_title_myst( content = "---\nsd_hide_title: true\n---\n\n# Heading\n\ncontent" builder.src_path.joinpath("index.md").write_text(content, encoding="utf8") builder.build() + doctree = builder.get_doctree("index", post_transforms=False) + doctree.attributes.pop("translation_progress", None) # added in sphinx 7.1 file_regression.check( - builder.get_doctree("index", post_transforms=False).pformat(), + doctree.pformat(), basename="sd_hide_title", extension=".xml", encoding="utf8", diff --git a/tox.ini b/tox.ini index 12c5777..f5c2f88 100644 --- a/tox.ini +++ b/tox.ini @@ -9,14 +9,10 @@ envlist = py38 [testenv] usedevelop = true -[testenv:py{37,38,39,310}] +[testenv:py{38,39,310,311}] description = Run unit tests with this Python version extras = testing -deps = - black - flake8~=3.8 - flake8-bugbear~=21.3 commands = pytest {posargs} [testenv:docs-{update,clean}-{alabaster,rtd,pydata,sbt,furo}]