From 8f4b2f0f3fb994f3e4ed6b0503c75094cedc1f74 Mon Sep 17 00:00:00 2001 From: Mark Dickinson Date: Tue, 5 Sep 2023 08:13:19 +0100 Subject: [PATCH] Fix Trait documenter tests for Sphinx >= 7.2 --- traits/util/tests/test_trait_documenter.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/traits/util/tests/test_trait_documenter.py b/traits/util/tests/test_trait_documenter.py index d06d36d46..b51430719 100644 --- a/traits/util/tests/test_trait_documenter.py +++ b/traits/util/tests/test_trait_documenter.py @@ -27,7 +27,6 @@ if sphinx is not None: from sphinx.ext.autodoc import ClassDocumenter, INSTANCEATTR, Options from sphinx.ext.autodoc.directive import DocumenterBridge - from sphinx.testing.path import path from sphinx.testing.util import SphinxTestApp from sphinx.util.docutils import LoggingReporter @@ -37,6 +36,11 @@ TraitDocumenter, ) + if sphinx.version_info < (7, 2): + from sphinx.testing.path import path as Path + else: + from pathlib import Path + # Configuration file content for testing. CONF_PY = """\ @@ -223,7 +227,7 @@ def create_directive(self): with open(conf_file, "w", encoding="utf-8") as f: f.write(CONF_PY) - app = SphinxTestApp(srcdir=path(tmpdir)) + app = SphinxTestApp(srcdir=Path(tmpdir)) app.builder.env.app = app app.builder.env.temp_data["docname"] = "dummy"