Skip to content

Commit

Permalink
Merge pull request #241 from pllim/fix-pytestdev-8.2
Browse files Browse the repository at this point in the history
MNT: consider_namespace_packages now required for pytest 8.2 or after
  • Loading branch information
bsipocz committed Mar 5, 2024
2 parents 6980aa5 + 1298865 commit 74be2dd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
1.3.0 (unreleased)
==================

- Compatibility with pytest 8.2. [#241]

1.2.0 (2024-03-04)
==================

Expand Down
11 changes: 8 additions & 3 deletions pytest_doctestplus/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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': '#',
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 74be2dd

Please sign in to comment.