From c432765556b5231da50a8ac6bc180f8f129aedb0 Mon Sep 17 00:00:00 2001 From: fijal Date: Tue, 30 Jan 2007 18:55:08 +0100 Subject: [PATCH] [svn r37631] Kill unnecessarry cache --HG-- branch : trunk --- py/test/conftesthandle.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/py/test/conftesthandle.py b/py/test/conftesthandle.py index d20b953c6..d62421c45 100644 --- a/py/test/conftesthandle.py +++ b/py/test/conftesthandle.py @@ -11,7 +11,6 @@ class Conftest(object): """ def __init__(self, path=None): self._path2confmods = {} - self._path2conftest_files = {} # direct cache of conftest files, to avoid confusion if path is not None: self.setinitial([path]) @@ -55,12 +54,14 @@ class Conftest(object): def getconftest(self, path): """ Return a direct module of that path """ + if isinstance(path, str): + path = py.path.local(path) 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: - conftestpath = path.join("conftest.py") - if conftestpath.check(file=1): - return self.importconfig(conftestpath) raise AttributeError # 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 @@ -99,5 +100,4 @@ class Conftest(object): mod = configpath.pyimport(modname=modname) else: mod = configpath.pyimport() - self._path2conftest_files[configpath.dirpath()] = mod return mod