Skip to content

Commit d65bcd9

Browse files
authored
Merge pull request #11808 from bluetech/doctest-conftest
doctest: remove special conftest handling
2 parents 1b78de4 + 06dbd3c commit d65bcd9

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

src/_pytest/doctest.py

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -558,24 +558,18 @@ def _from_module(self, module, object):
558558
else: # pragma: no cover
559559
pass
560560

561-
if self.path.name == "conftest.py":
562-
module = self.config.pluginmanager._importconftest(
561+
try:
562+
module = import_path(
563563
self.path,
564-
self.config.getoption("importmode"),
565-
rootpath=self.config.rootpath,
564+
root=self.config.rootpath,
565+
mode=self.config.getoption("importmode"),
566566
)
567-
else:
568-
try:
569-
module = import_path(
570-
self.path,
571-
root=self.config.rootpath,
572-
mode=self.config.getoption("importmode"),
573-
)
574-
except ImportError:
575-
if self.config.getvalue("doctest_ignore_import_errors"):
576-
skip("unable to import module %r" % self.path)
577-
else:
578-
raise
567+
except ImportError:
568+
if self.config.getvalue("doctest_ignore_import_errors"):
569+
skip("unable to import module %r" % self.path)
570+
else:
571+
raise
572+
579573
# Uses internal doctest module parsing mechanism.
580574
finder = MockAwareDocTestFinder()
581575
optionflags = get_optionflags(self.config)

0 commit comments

Comments
 (0)