[py-svn] r37631 - py/trunk/py/test

fijal at codespeak.net fijal at codespeak.net
Tue Jan 30 18:55:10 CET 2007


Author: fijal
Date: Tue Jan 30 18:55:08 2007
New Revision: 37631

Modified:
   py/trunk/py/test/conftesthandle.py
Log:
Kill unnecessarry cache


Modified: py/trunk/py/test/conftesthandle.py
==============================================================================
--- py/trunk/py/test/conftesthandle.py	(original)
+++ py/trunk/py/test/conftesthandle.py	Tue Jan 30 18:55:08 2007
@@ -11,7 +11,6 @@
     """ 
     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 @@
     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 @@
             mod = configpath.pyimport(modname=modname)
         else:
             mod = configpath.pyimport()
-        self._path2conftest_files[configpath.dirpath()] = mod
         return mod



More information about the pytest-commit mailing list