Skip to content

Commit

Permalink
Restore support in tests for Sphinx<7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Aug 9, 2023
1 parent 6f31e2b commit 1f04366
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,16 @@

import pytest

import sphinx

pytest_plugins = 'sphinx.testing.fixtures'


@pytest.fixture(scope='session')
def rootdir():
if sphinx.version_info[:2] < (7, 2):
from sphinx.testing.path import path

return path(__file__).parent.abspath() / 'roots'

return Path(__file__).resolve().parent / 'roots'
3 changes: 2 additions & 1 deletion tests/test_htmlhelp.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Test the HTML Help builder and check output against XPath."""

import re
from pathlib import Path

import pytest
from html5lib import HTMLParser
Expand Down Expand Up @@ -55,7 +56,7 @@ def test_chm(app):

# check .hhk file
outname = app.builder.config.htmlhelp_basename
hhk_path = (app.outdir / outname).with_suffix('.hhk')
hhk_path = Path(app.outdir / outname).with_suffix('.hhk')
data = hhk_path.read_bytes()
m = re.search(br'&#[xX][0-9a-fA-F]+;', data)
assert m is None, 'Hex escaping exists in .hhk file: ' + str(m.group(0))
Expand Down

0 comments on commit 1f04366

Please sign in to comment.