diff --git a/CHANGES.rst b/CHANGES.rst index d566e1c..f877229 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,8 @@ 1.3.0 (unreleased) ================== +- Compatibility with pytest 8.2. [#241] + 1.2.0 (2024-03-04) ================== diff --git a/pytest_doctestplus/plugin.py b/pytest_doctestplus/plugin.py index 65422c6..df33e44 100644 --- a/pytest_doctestplus/plugin.py +++ b/pytest_doctestplus/plugin.py @@ -31,9 +31,10 @@ PYTEST_GT_5 = _pytest_version > Version('5.9.9') PYTEST_GE_5_4 = _pytest_version >= Version('5.4') PYTEST_GE_7_0 = _pytest_version >= Version('7.0') -PYTEST_GE_8_0 = any([_pytest_version.is_devrelease, +PYTEST_GE_8_0 = _pytest_version >= Version('8.0') +PYTEST_GE_8_2 = any([_pytest_version.is_devrelease, _pytest_version.is_prerelease, - _pytest_version >= Version('8.0')]) + _pytest_version >= Version('8.2')]) comment_characters = { '.txt': '#', @@ -264,7 +265,11 @@ def collect(self): from _pytest.pathlib import import_path mode = self.config.getoption("importmode") - if PYTEST_GE_7_0: + if PYTEST_GE_8_2: + consider_namespace_packages = self.config.getini("consider_namespace_packages") + module = import_path(fspath, mode=mode, root=self.config.rootpath, + consider_namespace_packages=consider_namespace_packages) + elif PYTEST_GE_7_0: module = import_path(fspath, mode=mode, root=self.config.rootpath) elif PYTEST_GT_5: module = import_path(fspath, mode=mode)