Check Path in confcudir parent hierarchy

Fixes: #9767

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2022-03-16 17:52:04 +05:30
parent f0bf4c9681
commit 1f2a70d586
1 changed files with 1 additions and 5 deletions

View File

@ -538,11 +538,7 @@ class PytestPluginManager(PluginManager):
"""
if self._confcutdir is None:
return True
try:
path.relative_to(self._confcutdir)
except ValueError:
return False
return True
return path not in self._confcutdir.parents
def _try_load_conftest(
self, anchor: Path, importmode: Union[str, ImportMode], rootpath: Path