From 3d1571649fe3fdb77afebb4f7cb53d80b22c2fc2 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Sat, 12 Aug 2023 06:52:25 +0100 Subject: [PATCH 1/2] Only use ``sphinx.testing.path`` on Sphinx 7.1 and earlier --- tests/conftest.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 6fd8155f6..c4aab0d62 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -6,8 +6,8 @@ from typing import Callable import pytest +import sphinx from bs4 import BeautifulSoup -from sphinx.testing.path import path as sphinx_path from sphinx.testing.util import SphinxTestApp from typing_extensions import Self @@ -70,10 +70,15 @@ def sphinx_build_factory(make_app: Callable, tmp_path: Path) -> Callable: def _func(src_folder: Path, **kwargs) -> SphinxBuild: """Create the Sphinxbuild from the source folder.""" + + srcdir = tmp_path / src_folder + if sphinx.version_info < (7, 2): + from sphinx.testing.path import path as sphinx_path + + srcdir = sphinx_path(srcdir) + copytree(path_tests / "sites" / src_folder, tmp_path / src_folder) - app = make_app( - srcdir=sphinx_path(Path(tmp_path / src_folder).resolve()), **kwargs - ) + app = make_app(srcdir=srcdir, **kwargs) return SphinxBuild(app, tmp_path / src_folder) yield _func From c266a4402c68c333ba9d36435c9f9c10238c6b7b Mon Sep 17 00:00:00 2001 From: Daniel McCloy Date: Mon, 14 Aug 2023 09:44:18 -0500 Subject: [PATCH 2/2] fix Ruff --- tests/conftest.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index c4aab0d62..219631875 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -70,7 +70,6 @@ def sphinx_build_factory(make_app: Callable, tmp_path: Path) -> Callable: def _func(src_folder: Path, **kwargs) -> SphinxBuild: """Create the Sphinxbuild from the source folder.""" - srcdir = tmp_path / src_folder if sphinx.version_info < (7, 2): from sphinx.testing.path import path as sphinx_path