Skip to content

Commit

Permalink
🐛 deal with failing tests due to Sphinx>=7 (#47)
Browse files Browse the repository at this point in the history
* 🐛 deal with failing tests due to Sphinx>=7

* Revert changes to coverage CI

* 📺 revert to also testing python 3.8

* 📺 attempt to fix python 3.8 errors in CI
  • Loading branch information
smutch committed Nov 22, 2023
1 parent 1b79758 commit bbb6cf9
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

- uses: actions/setup-python@v3
with:
python-version: "3.11"
python-version: "3.12"

- name: Install Hatch
run: pip install --upgrade --pre hatch
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
python-version: '3.12'

- name: Install Hatch
run: pip install --upgrade --pre hatch
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest] #, windows-latest, macos-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v3
Expand All @@ -37,7 +37,7 @@ jobs:
- name: Install Hatch
run: pip install --upgrade --pre hatch

- if: matrix.python-version == '3.11' && runner.os == 'Linux'
- if: matrix.python-version == '3.12' && runner.os == 'Linux'
name: Lint
run: hatch run lint:style

Expand Down
6 changes: 5 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import sys
from pathlib import Path

import pytest
import sphinx
from bs4 import BeautifulSoup
from sphinx.application import Sphinx

Expand All @@ -12,7 +14,9 @@

@pytest.fixture(scope='session')
def rootdir():
return Path(__file__).parent.absolute() / 'roots'
if sphinx.version_info[0] < 7 or sys.version_info < (3, 9):
return sphinx.testing.path.path(__file__).parent.abspath() / 'roots'
return (Path(__file__).parent / 'roots').resolve()


def build_and_blend(app: Sphinx, file: str = "index.html") -> str:
Expand Down
5 changes: 5 additions & 0 deletions tests/test_regressions.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import re
import sys

import pytest
import sphinx
from sphinx.application import Sphinx

# Note that we stop checking the body from the footer onwards. This is because the footer contains the exact versions of
# the Sphinx etc. which we don't care about and will break the testss with dependabot PRs etc.
body_pattern = re.compile(r'<body>.*<div class="footer">', re.DOTALL)


@pytest.mark.skipif(
sphinx.version_info[0] < 7 or sys.version_info < (3, 9), reason="regression test is Sphinx version dependent (>=7)"
)
@pytest.mark.sphinx('html', testroot='docs')
def test_build(data_regression, app: Sphinx):
app.builder.build_all()
Expand Down

0 comments on commit bbb6cf9

Please sign in to comment.