From 1655796d48cb67d7247b41a09fe5c2463b32d47a Mon Sep 17 00:00:00 2001 From: Stephan Richter Date: Sun, 27 Jan 2019 14:37:40 -0500 Subject: Make sure that the cache is properly filled. (25x speedup on our system that has a large sys.path.) It is always a bad idea to reassign the cachekey during the computation. --- coverage/files.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'coverage/files.py') diff --git a/coverage/files.py b/coverage/files.py index b328f653..d9495912 100644 --- a/coverage/files.py +++ b/coverage/files.py @@ -59,6 +59,7 @@ def canonical_filename(filename): """ if filename not in CANONICAL_FILENAME_CACHE: + cf = filename if not os.path.isabs(filename): for path in [os.curdir] + sys.path: if path is None: @@ -69,9 +70,9 @@ def canonical_filename(filename): except UnicodeError: exists = False if exists: - filename = f + cf = f break - cf = abs_file(filename) + cf = abs_file(cf) CANONICAL_FILENAME_CACHE[filename] = cf return CANONICAL_FILENAME_CACHE[filename] -- cgit v1.2.1