[py-svn] r34413 - py/dist/py/test
fijal at codespeak.net
fijal at codespeak.net
Thu Nov 9 15:19:39 CET 2006
Author: fijal
Date: Thu Nov 9 15:19:35 2006
New Revision: 34413
Modified:
py/dist/py/test/config.py
Log:
Improved caching of configs.
Modified: py/dist/py/test/config.py
==============================================================================
--- py/dist/py/test/config.py (original)
+++ py/dist/py/test/config.py Thu Nov 9 15:19:35 2006
@@ -172,19 +172,26 @@
Config._reset()
return config
+_config_paths_cache = {}
def guessconfigpaths(*paths):
""" return test configuration paths from skimming the args. """
+ key = tuple(paths)
+ try:
+ return _config_paths_cache[key]
+ except KeyError:
+ pass
d = {}
l = []
- for anchor in paths:
- if anchor:
+ for anchor in paths:
+ if anchor:
for p in anchor.parts():
x = p.join(configbasename)
if x not in d and x.check(file=1):
d[x] = True
l.append(x)
l.reverse()
+ _config_paths_cache[key] = l
return l
def getanchorpaths(args):
@@ -199,7 +206,7 @@
l = [current]
return l
-def importconfig(configpath):
+def importconfig(configpath):
if not configpath.dirpath('__init__.py').check(file=1):
# HACK: we don't want a "globally" imported conftest.py,
# prone to conflicts and subtle problems
More information about the pytest-commit
mailing list