From 649df324a88c4ae2f788ea6ea8102cfb1d53207b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Wed, 9 Aug 2023 17:23:43 -0700 Subject: [PATCH] MAINT: fix pytest 8.0dev compatibility --- pytest_doctestplus/plugin.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pytest_doctestplus/plugin.py b/pytest_doctestplus/plugin.py index af01501..2179e3e 100644 --- a/pytest_doctestplus/plugin.py +++ b/pytest_doctestplus/plugin.py @@ -26,9 +26,10 @@ _pytest_version = Version(pytest.__version__) PYTEST_GT_5 = _pytest_version > Version('5.9.9') PYTEST_GE_5_4 = _pytest_version >= Version('5.4') -PYTEST_GE_7_0 = any([_pytest_version.is_devrelease, +PYTEST_GE_7_0 = _pytest_version >= Version('7.0') +PYTEST_GE_8_0 = any([_pytest_version.is_devrelease, _pytest_version.is_prerelease, - _pytest_version >= Version('7.0')]) + _pytest_version >= Version('8.0')]) comment_characters = { '.txt': '#', @@ -507,7 +508,11 @@ def pytest_ignore_collect(self, path, config): Skip paths that match any of the doctest_norecursedirs patterns or if doctest_only is True then skip all regular test files (eg test_*.py). """ - if PYTEST_GE_7_0: + if PYTEST_GE_8_0: + dirpath = Path(path).parent + collect_ignore = config._getconftest_pathlist("collect_ignore", + path=dirpath) + elif PYTEST_GE_7_0: dirpath = Path(path).parent collect_ignore = config._getconftest_pathlist("collect_ignore", path=dirpath,