doctest: remove special conftest handling

(Diff better viewed ignoring whitespace)

Since e1c66ab0ad, conftest loading is
handled at the directory level before sub-nodes are collected, so there
is no need for the doctest plugin to handle it specially.

This was probably the case even before
e1c66ab0ad, but I haven't verified this.
This commit is contained in:
Ran Benita 2024-01-13 11:15:05 +02:00
parent 1b78de4e21
commit 06dbd3c21c
1 changed files with 10 additions and 16 deletions

View File

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