From be9d1543ee1b40a8537297ec38401d285550cfb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Est=C3=A8ve?= Date: Wed, 10 Jan 2024 06:57:17 +0100 Subject: [PATCH] Keep AssertionError for now --- src/_pytest/config/__init__.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/_pytest/config/__init__.py b/src/_pytest/config/__init__.py index 3fedc627f1b..0e99ad04db7 100644 --- a/src/_pytest/config/__init__.py +++ b/src/_pytest/config/__init__.py @@ -656,10 +656,8 @@ def _importconftest( if dirpath in self._dirpath2confmods: for path, mods in self._dirpath2confmods.items(): if dirpath in path.parents or path == dirpath: - if mod in mods: - raise RuntimeError( - f"{str(conftestpath)=} has already been loaded as the module {mod=}" - ) + error_message = f"{str(conftestpath)=} has already been loaded as the module {mod=}" + assert mod not in mods, error_message mods.append(mod) self.trace(f"loading conftestmodule {mod!r}") self.consider_conftest(mod)