From 560c055b090c2cc951c687728ee84353126a53ab Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Fri, 9 Nov 2018 01:36:20 +0100 Subject: [PATCH] Session._collect: use reversed parts --- src/_pytest/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/_pytest/main.py b/src/_pytest/main.py index 1de5f656f..5b9a94998 100644 --- a/src/_pytest/main.py +++ b/src/_pytest/main.py @@ -495,9 +495,9 @@ class Session(nodes.FSCollector): # No point in finding packages when collecting doctests if not self.config.option.doctestmodules: pm = self.config.pluginmanager - for parent in argpath.parts(): + for parent in reversed(argpath.parts()): if pm._confcutdir and pm._confcutdir.relto(parent): - continue + break if parent.isdir(): pkginit = parent.join("__init__.py")