Skip to content

Commit 1298865

Browse files
committed
MNT: consider_namespace_packages
now required for pytest 8.2 or after
1 parent 6980aa5 commit 1298865

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

CHANGES.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
1.3.0 (unreleased)
22
==================
33

4+
- Compatibility with pytest 8.2. [#241]
5+
46
1.2.0 (2024-03-04)
57
==================
68

pytest_doctestplus/plugin.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@
3131
PYTEST_GT_5 = _pytest_version > Version('5.9.9')
3232
PYTEST_GE_5_4 = _pytest_version >= Version('5.4')
3333
PYTEST_GE_7_0 = _pytest_version >= Version('7.0')
34-
PYTEST_GE_8_0 = any([_pytest_version.is_devrelease,
34+
PYTEST_GE_8_0 = _pytest_version >= Version('8.0')
35+
PYTEST_GE_8_2 = any([_pytest_version.is_devrelease,
3536
_pytest_version.is_prerelease,
36-
_pytest_version >= Version('8.0')])
37+
_pytest_version >= Version('8.2')])
3738

3839
comment_characters = {
3940
'.txt': '#',
@@ -264,7 +265,11 @@ def collect(self):
264265
from _pytest.pathlib import import_path
265266
mode = self.config.getoption("importmode")
266267

267-
if PYTEST_GE_7_0:
268+
if PYTEST_GE_8_2:
269+
consider_namespace_packages = self.config.getini("consider_namespace_packages")
270+
module = import_path(fspath, mode=mode, root=self.config.rootpath,
271+
consider_namespace_packages=consider_namespace_packages)
272+
elif PYTEST_GE_7_0:
268273
module = import_path(fspath, mode=mode, root=self.config.rootpath)
269274
elif PYTEST_GT_5:
270275
module = import_path(fspath, mode=mode)

0 commit comments

Comments
 (0)