From b19374bc193fddfe2b0c2da21e4e3a96846f15ea Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Fri, 7 Jan 2022 12:15:34 +0200 Subject: [PATCH] config: fix incorrect cache hit check in _getconftestmodules This made the cache not work as intended, causing a major slowdown. See #9478 for discussion and context. Authored-by: Anthony Sottile --- src/_pytest/config/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_pytest/config/__init__.py b/src/_pytest/config/__init__.py index dee3d4974..174d80a01 100644 --- a/src/_pytest/config/__init__.py +++ b/src/_pytest/config/__init__.py @@ -538,7 +538,7 @@ class PytestPluginManager(PluginManager): # Optimization: avoid repeated searches in the same directory. # Assumes always called with same importmode and rootpath. existing_clist = self._dirpath2confmods.get(directory) - if existing_clist: + if existing_clist is not None: return existing_clist # XXX these days we may rather want to use config.rootpath