From f85516b0d8852ce1dcf081bfda9414c247bca171 Mon Sep 17 00:00:00 2001 From: Kazuya Takei Date: Fri, 21 Feb 2025 23:35:46 +0900 Subject: [PATCH] ci: Toggle type of rootdir for sphinx version - This is for pass tests using sphinx.testing.path with sphinx 8.2.x - But some tests are failure by bug of itself. Refs: #189 --- tests/conftest.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 818fc04..30f2334 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,11 +1,14 @@ """Configuration for pytest.""" import inspect +from pathlib import Path import pytest from _pytest.config import Config +from packaging import version from sphinx import deprecation -from sphinx.testing.path import path + +from sphinx_revealjs.deprecated import _get_sphinx_version pytest_plugins = "sphinx.testing.fixtures" collect_ignore = ["roots"] @@ -23,4 +26,10 @@ def pytest_configure(config: Config): # noqa @pytest.fixture(scope="session") def rootdir(): """Set root directory to use testing sphinx project.""" - return path(__file__).parent.abspath() / "roots" + current_ver = _get_sphinx_version() + delimter_ver = version.parse("7.2.0") + if current_ver < delimter_ver: + from sphinx.testing.path import path + + return path(__file__).parent.abspath() / "roots" + return Path(__file__).parent.resolve() / "roots"