We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents c6ed864 + 1c9d683 commit 2bb0ecaCopy full SHA for 2bb0eca
src/_pytest/config/__init__.py
@@ -664,7 +664,12 @@ def _importconftest(
664
if dirpath in self._dirpath2confmods:
665
for path, mods in self._dirpath2confmods.items():
666
if dirpath in path.parents or path == dirpath:
667
- assert mod not in mods
+ if mod in mods:
668
+ raise AssertionError(
669
+ f"While trying to load conftest path {str(conftestpath)}, "
670
+ f"found that the module {mod} is already loaded with path {mod.__file__}. "
671
+ "This is not supposed to happen. Please report this issue to pytest."
672
+ )
673
mods.append(mod)
674
self.trace(f"loading conftestmodule {mod!r}")
675
self.consider_conftest(mod, registration_name=conftestpath_plugin_name)
0 commit comments