Skip to content

Commit

Permalink
⬆️ UPGRADE: sphinx>=5,<8 (#148)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell authored Jul 27, 2023
1 parent 9129c5e commit 9dfaa9a
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 41 deletions.
35 changes: 10 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -108,7 +94,6 @@ jobs:
needs:
- pre-commit
- tests
- tests-sphinx4
- docs-build-format

runs-on: ubuntu-latest
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ 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"
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",
Expand Down
26 changes: 18 additions & 8 deletions tests/test_snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down
6 changes: 1 addition & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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}]
Expand Down

0 comments on commit 9dfaa9a

Please sign in to comment.