diff options
author | 2011-03-08 09:51:38 +0100 | |
---|---|---|
committer | 2011-03-08 09:51:38 +0100 | |
commit | ec8ec56f18323046ee4c63578fdb90459e9501fb (patch) | |
tree | 81cc8a461704b7543fe120043bafc97f491604ba /_pytest/main.py | |
parent | fix url / install references (diff) | |
download | pypy-ec8ec56f18323046ee4c63578fdb90459e9501fb.tar.gz pypy-ec8ec56f18323046ee4c63578fdb90459e9501fb.tar.bz2 pypy-ec8ec56f18323046ee4c63578fdb90459e9501fb.zip |
copy latest pytest release candidate
Diffstat (limited to '_pytest/main.py')
-rw-r--r-- | _pytest/main.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/_pytest/main.py b/_pytest/main.py index a257ea56f2..d7948c6faf 100644 --- a/_pytest/main.py +++ b/_pytest/main.py @@ -326,7 +326,13 @@ class Item(Node): return self._location except AttributeError: location = self.reportinfo() - fspath = self.session.fspath.bestrelpath(location[0]) + # bestrelpath is a quite slow function + cache = self.config.__dict__.setdefault("_bestrelpathcache", {}) + try: + fspath = cache[location[0]] + except KeyError: + fspath = self.session.fspath.bestrelpath(location[0]) + cache[location[0]] = fspath location = (fspath, location[1], str(location[2])) self._location = location return location |