diff --git a/tests/conftest.py b/tests/conftest.py index bad18f1..d4b08e5 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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' diff --git a/tests/test_htmlhelp.py b/tests/test_htmlhelp.py index c00a476..f0d74b6 100644 --- a/tests/test_htmlhelp.py +++ b/tests/test_htmlhelp.py @@ -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 @@ -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))