_getconftestmodules: avoid isfile()/dirpath()

Ref: https://github.com/pytest-dev/pytest/issues/2206#issuecomment-432623646
This commit is contained in:
Daniel Hahler 2018-10-24 14:04:51 +02:00
parent 041044eef0
commit 63691f5656
1 changed files with 6 additions and 6 deletions

View File

@ -387,13 +387,13 @@ class PytestPluginManager(PluginManager):
if self._noconftest:
return []
if path.isfile():
directory = path.dirpath()
else:
directory = path
try:
return self._path2confmods[directory]
return self._path2confmods[path]
except KeyError:
if path.isfile():
directory = path.dirpath()
else:
directory = path
# XXX these days we may rather want to use config.rootdir
# and allow users to opt into looking into the rootdir parent
# directories instead of requiring to specify confcutdir
@ -406,7 +406,7 @@ class PytestPluginManager(PluginManager):
mod = self._importconftest(conftestpath)
clist.append(mod)
self._path2confmods[directory] = clist
self._path2confmods[path] = clist
return clist
def _rget_with_confmod(self, name, path):