Source: pytest-doctestplus Version: 0.7.0-1 Severity: important User: pyt...@packages.debian.org Usertags: pytest-v6 Tags: patch
Hi, It would be appreciated if you could include the attached patch in the next release. It enables forward compatibility with pytest 6.0.0, currently in experimental. This would fix a FTBFS with ~15 packages build-depending on python3-pytest-doctestplus. Thanks! Christian
From: Christian Kastner <c...@kvr.at> Date: Fri, 11 Dec 2020 00:03:07 +0100 Subject: Compatibility with pytest 6.0.0 This enables forward compatibility with pytest 6.0.0. Bug: https://github.com/astropy/pytest-doctestplus/issues/118 Origin: https://github.com/astropy/pytest-doctestplus/pull/120/commits/1a661006d8d01986830a7baf3812cfce63ec2705 --- pytest_doctestplus/plugin.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pytest_doctestplus/plugin.py b/pytest_doctestplus/plugin.py index e6556a2..10109b0 100644 --- a/pytest_doctestplus/plugin.py +++ b/pytest_doctestplus/plugin.py @@ -10,6 +10,8 @@ import re import sys import warnings +from packaging.version import Version + import pytest from pytest_doctestplus.utils import ModuleChecker @@ -21,6 +23,8 @@ except ImportError: # PY2 def indent(text, prefix): return '\n'.join([prefix + line for line in text.splitlines()]) +PYTEST_GT_5 = Version(pytest.__version__) > Version('5.9.9') + comment_characters = { '.txt': '#', '.tex': '%', @@ -169,7 +173,12 @@ def pytest_configure(config): if self.fspath.basename == "setup.py": return elif self.fspath.basename == "conftest.py": - module = self.config.pluginmanager._importconftest(self.fspath) + if PYTEST_GT_5: + module = self.config.pluginmanager._importconftest( + self.fspath, self.config.getoption("importmode")) + else: + module = self.config.pluginmanager._importconftest( + self.fspath) else: try: module = self.fspath.pyimport() -- 2.29.2