Merge pull request #11808 from bluetech/doctest-conftest

doctest: remove special conftest handling
This commit is contained in:
Ran Benita 2024-01-13 19:50:20 +02:00 committed by GitHub
commit d65bcd9a3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 16 deletions

View File

@ -558,24 +558,18 @@ class DoctestModule(Module):
else: # pragma: no cover
pass
if self.path.name == "conftest.py":
module = self.config.pluginmanager._importconftest(
try:
module = import_path(
self.path,
self.config.getoption("importmode"),
rootpath=self.config.rootpath,
root=self.config.rootpath,
mode=self.config.getoption("importmode"),
)
else:
try:
module = import_path(
self.path,
root=self.config.rootpath,
mode=self.config.getoption("importmode"),
)
except ImportError:
if self.config.getvalue("doctest_ignore_import_errors"):
skip("unable to import module %r" % self.path)
else:
raise
except ImportError:
if self.config.getvalue("doctest_ignore_import_errors"):
skip("unable to import module %r" % self.path)
else:
raise
# Uses internal doctest module parsing mechanism.
finder = MockAwareDocTestFinder()
optionflags = get_optionflags(self.config)