Skip to content

Commit 2d995d2

Browse files
committed
Remove _importconftest call on pytest>=8
The _importconftest call is no longer needed in the collect method of the SphinxDoctestModule class according to #58. Therefore, it is removed in this commit. Closes #58
1 parent d8a1656 commit 2d995d2

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

src/pytest_sphinx.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -556,20 +556,13 @@ def collect(self) -> Iterator[_pytest.doctest.DoctestItem]:
556556

557557
class SphinxDoctestModule(pytest.Module):
558558
def collect(self) -> Iterator[_pytest.doctest.DoctestItem]:
559-
if self.fspath.basename == "conftest.py":
560-
module = self.config.pluginmanager._importconftest(
561-
self.path,
562-
self.config.getoption("importmode"),
563-
rootpath=self.config.rootpath,
564-
)
565-
else:
566-
try:
567-
module = import_path(self.path, root=self.config.rootpath)
568-
except ImportError:
569-
if self.config.getvalue("doctest_ignore_import_errors"):
570-
pytest.skip("unable to import module %r" % self.path)
571-
else:
572-
raise
559+
try:
560+
module = import_path(self.path, root=self.config.rootpath)
561+
except ImportError:
562+
if self.config.getvalue("doctest_ignore_import_errors"):
563+
pytest.skip("unable to import module %r" % self.path)
564+
else:
565+
raise
573566
optionflags = _pytest.doctest.get_optionflags(self.config) # type:ignore
574567

575568
class MockAwareDocTestFinder(doctest.DocTestFinder):

0 commit comments

Comments
 (0)