diff --git a/pytest_doctestplus/plugin.py b/pytest_doctestplus/plugin.py index c9388d1..263478c 100644 --- a/pytest_doctestplus/plugin.py +++ b/pytest_doctestplus/plugin.py @@ -499,16 +499,12 @@ def pytest_ignore_collect(self, path, config): """ if PYTEST_GE_7_0: dirpath = Path(path).parent - else: - dirpath = path.dirpath() - - try: - collect_ignore = config._getconftest_pathlist("collect_ignore", path=dirpath) - except TypeError: - # Pytest 7.0+ collect_ignore = config._getconftest_pathlist("collect_ignore", path=dirpath, rootpath=config.rootpath) + else: + dirpath = path.dirpath() + collect_ignore = config._getconftest_pathlist("collect_ignore", path=dirpath) # The collect_ignore conftest.py variable should cause all test # runners to ignore this file and all subfiles and subdirectories