Skip to content

Commit

Permalink
Make the tests pass with Sphinx 7.1
Browse files Browse the repository at this point in the history
Fixes #25.
  • Loading branch information
mitya57 committed Jul 31, 2023
1 parent f45993d commit ac97ce5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@ jobs:
- "4" # jQuery included
- "5" # jQuery deprecated
- "6" # jQuery removed
- "7"
exclude:
# Sphinx 6 does not support Python 3.7
# Sphinx >= 6 does not support Python 3.7
- python: "3.7"
sphinx: "6"
- python: "3.7"
sphinx: "7"

steps:
- uses: actions/checkout@v3
Expand Down
12 changes: 8 additions & 4 deletions tests/test_jquery_installed.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@ def test_jquery_installed_sphinx_ge_60_use_sri(blank_app):
out_dir = blank_app(confoverrides={"extensions": ["sphinxcontrib.jquery"], "jquery_use_sri": True})

text = out_dir.joinpath("index.html").read_text(encoding="utf-8")
checksum = '?v=5d32c60e' if sphinx.version_info[:2] >= (7, 1) else ''
assert ('<script '
'integrity="sha384-vtXRMe3mGCbOeY7l30aIg8H9p3GdeSe4IFlP6G8JMa7o7lXvnz3GFKzPxzJdPfGK" '
'src="_static/jquery.js"></script>') in text
f'src="_static/jquery.js{checksum}"></script>') in text
checksum = '?v=2cd50e6c' if sphinx.version_info[:2] >= (7, 1) else ''
assert ('<script '
'integrity="sha384-lSZeSIVKp9myfKbDQ3GkN/KHjUc+mzg17VKDN4Y2kUeBSJioB9QSM639vM9fuY//" '
'src="_static/_sphinx_javascript_frameworks_compat.js"></script>') in text
f'src="_static/_sphinx_javascript_frameworks_compat.js{checksum}"></script>') in text

static_dir = out_dir / '_static'
assert static_dir.joinpath('jquery.js').is_file()
Expand All @@ -56,10 +58,12 @@ def test_jquery_installed_sphinx_ge_60(blank_app):
out_dir = blank_app(confoverrides={"extensions": ["sphinxcontrib.jquery"]})

text = out_dir.joinpath("index.html").read_text(encoding="utf-8")
checksum = '?v=5d32c60e' if sphinx.version_info[:2] >= (7, 1) else ''
assert ('<script '
'src="_static/jquery.js"></script>') in text
f'src="_static/jquery.js{checksum}"></script>') in text
checksum = '?v=2cd50e6c' if sphinx.version_info[:2] >= (7, 1) else ''
assert ('<script '
'src="_static/_sphinx_javascript_frameworks_compat.js"></script>') in text
f'src="_static/_sphinx_javascript_frameworks_compat.js{checksum}"></script>') in text

static_dir = out_dir / '_static'
assert static_dir.joinpath('jquery.js').is_file()
Expand Down

0 comments on commit ac97ce5

Please sign in to comment.