From 22afde54e77aec0f837c1c65230f6bb2deb9d9b1 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sat, 6 Apr 2024 12:13:46 -0300 Subject: [PATCH] Improve readability in resolve_pkg_root_and_module_name a bit This makes it more clear what is the purpose of the start variable. --- src/_pytest/pathlib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_pytest/pathlib.py b/src/_pytest/pathlib.py index 90cd01a84..b83619f56 100644 --- a/src/_pytest/pathlib.py +++ b/src/_pytest/pathlib.py @@ -786,7 +786,7 @@ def resolve_pkg_root_and_module_name( if pkg_path is not None: pkg_root = pkg_path.parent if consider_namespace_packages: - start = path.parent if pkg_path is None else pkg_path.parent + start = pkg_root if pkg_root is not None else path.parent for candidate in (start, *start.parents): if is_importable(candidate, path): # Point the pkg_root to the root of the namespace package.