Skip to content

Commit

Permalink
_getconftestmodules: avoid isfile()/dirpath()
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed committed Oct 26, 2018
1 parent 5f1a30b commit 1f50de2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/_pytest/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,13 +388,13 @@ def _getconftestmodules(self, path):
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
Expand All @@ -407,7 +407,7 @@ def _getconftestmodules(self, path):
mod = self._importconftest(conftestpath)
clist.append(mod)

self._path2confmods[directory] = clist
self._path2confmods[path] = clist
return clist

def _rget_with_confmod(self, name, path):
Expand Down

0 comments on commit 1f50de2

Please sign in to comment.