From 053609e4642d8f7f533c8cd63e5fe7d6b30a3d54 Mon Sep 17 00:00:00 2001 From: FumeDev Date: Sun, 24 Mar 2024 15:43:21 -0700 Subject: [PATCH] Reverted `_is_in_confcutdir` logic to fix `conftest.py` handling, validated with pytest suite. --- src/_pytest/config/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/_pytest/config/__init__.py b/src/_pytest/config/__init__.py index f1b93a0a50f..5d3e3beb01f 100644 --- a/src/_pytest/config/__init__.py +++ b/src/_pytest/config/__init__.py @@ -534,10 +534,10 @@ def _set_initial_conftests( self._try_load_conftest(current, namespace.importmode, rootpath) def _is_in_confcutdir(self, path: Path) -> bool: - """Whether a path is within the confcutdir.""" + """Whether a path is within the confcutdir. When false, should not load conftest.""" if self._confcutdir is None: return True - return path not in self._confcutdir.parents + return self._confcutdir not in path.parents def _try_load_conftest( self, anchor: Path, importmode: Union[str, ImportMode], rootpath: Path