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.
1 parent 10c8898 commit f15aff0Copy full SHA for f15aff0
src/_pytest/config/__init__.py
@@ -660,7 +660,12 @@ def _importconftest(
660
if dirpath in self._dirpath2confmods:
661
for path, mods in self._dirpath2confmods.items():
662
if dirpath in path.parents or path == dirpath:
663
- assert mod not in mods
+ if mod in mods:
664
+ raise AssertionError(
665
+ f"While trying to load conftest path {str(conftestpath)}, "
666
+ f"found that the module {mod} is already loaded with path {mod.__file__}. "
667
+ "This is not supposed to happen. Please report this issue to pytest."
668
+ )
669
mods.append(mod)
670
self.trace(f"loading conftestmodule {mod!r}")
671
self.consider_conftest(mod, registration_name=conftestpath_plugin_name)
0 commit comments