[svn r37631] Kill unnecessarry cache

--HG--
branch : trunk
This commit is contained in:
fijal 2007-01-30 18:55:08 +01:00
parent 3630e7fcd3
commit c432765556
1 changed files with 6 additions and 6 deletions

View File

@ -11,7 +11,6 @@ class Conftest(object):
""" """
def __init__(self, path=None): def __init__(self, path=None):
self._path2confmods = {} self._path2confmods = {}
self._path2conftest_files = {} # direct cache of conftest files, to avoid confusion
if path is not None: if path is not None:
self.setinitial([path]) self.setinitial([path])
@ -55,12 +54,14 @@ class Conftest(object):
def getconftest(self, path): def getconftest(self, path):
""" Return a direct module of that path """ Return a direct module of that path
""" """
if isinstance(path, str):
path = py.path.local(path)
try: try:
return self._path2conftest_files[path] conftestmod = self.getconftestmodules(path)[-1]
if py.path.local(conftestmod.__file__).dirpath() != path:
raise AttributeError
return conftestmod
except KeyError: except KeyError:
conftestpath = path.join("conftest.py")
if conftestpath.check(file=1):
return self.importconfig(conftestpath)
raise AttributeError raise AttributeError
# we raise here AttributeError to unify error reporting in case # we raise here AttributeError to unify error reporting in case
# of lack of variable in conftest or lack of file, but we do not want to # of lack of variable in conftest or lack of file, but we do not want to
@ -99,5 +100,4 @@ class Conftest(object):
mod = configpath.pyimport(modname=modname) mod = configpath.pyimport(modname=modname)
else: else:
mod = configpath.pyimport() mod = configpath.pyimport()
self._path2conftest_files[configpath.dirpath()] = mod
return mod return mod