Skip to content

Commit

Permalink
MAINT: remove special conftest handling
Browse files Browse the repository at this point in the history
  • Loading branch information
bsipocz committed Jan 26, 2024
1 parent 15ab106 commit 82ae205
Showing 1 changed file with 13 additions and 25 deletions.
38 changes: 13 additions & 25 deletions pytest_doctestplus/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,34 +259,22 @@ def collect(self):

if filepath in ("setup.py", "__main__.py"):
return
elif filepath == "conftest.py":
try:
if PYTEST_GT_5:
from _pytest.pathlib import import_path
mode = self.config.getoption("importmode")

if PYTEST_GE_7_0:
module = self.config.pluginmanager._importconftest(
self.path, self.config.getoption("importmode"),
rootpath=self.config.rootpath)
module = import_path(fspath, mode=mode, root=self.config.rootpath)
elif PYTEST_GT_5:
module = self.config.pluginmanager._importconftest(
self.fspath, self.config.getoption("importmode"))
module = import_path(fspath, mode=mode)
else:
module = self.config.pluginmanager._importconftest(
self.fspath)
else:
try:
if PYTEST_GT_5:
from _pytest.pathlib import import_path
mode = self.config.getoption("importmode")

if PYTEST_GE_7_0:
module = import_path(fspath, mode=mode, root=self.config.rootpath)
elif PYTEST_GT_5:
module = import_path(fspath, mode=mode)
else:
module = fspath.pyimport()
except ImportError:
if self.config.getvalue("doctest_ignore_import_errors"):
pytest.skip("unable to import module %r" % fspath)
else:
raise
module = fspath.pyimport()
except ImportError:
if self.config.getvalue("doctest_ignore_import_errors"):
pytest.skip("unable to import module %r" % fspath)
else:
raise

options = get_optionflags(self) | FIX

Expand Down

0 comments on commit 82ae205

Please sign in to comment.