Skip to content

Commit

Permalink
Remove _importconftest call on pytest>=8
Browse files Browse the repository at this point in the history
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
  • Loading branch information
twmr committed Feb 4, 2024
1 parent d8a1656 commit 2d995d2
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions src/pytest_sphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,20 +556,13 @@ def collect(self) -> Iterator[_pytest.doctest.DoctestItem]:

class SphinxDoctestModule(pytest.Module):
def collect(self) -> Iterator[_pytest.doctest.DoctestItem]:
if self.fspath.basename == "conftest.py":
module = self.config.pluginmanager._importconftest(
self.path,
self.config.getoption("importmode"),
rootpath=self.config.rootpath,
)
else:
try:
module = import_path(self.path, root=self.config.rootpath)
except ImportError:
if self.config.getvalue("doctest_ignore_import_errors"):
pytest.skip("unable to import module %r" % self.path)
else:
raise
try:
module = import_path(self.path, root=self.config.rootpath)
except ImportError:
if self.config.getvalue("doctest_ignore_import_errors"):
pytest.skip("unable to import module %r" % self.path)
else:
raise
optionflags = _pytest.doctest.get_optionflags(self.config) # type:ignore

class MockAwareDocTestFinder(doctest.DocTestFinder):
Expand Down

0 comments on commit 2d995d2

Please sign in to comment.