coverage: deal with symlinked input paths (MacOSX issue)
authorPatrick Mezard <pmezard@gmail.com>
Sat, 22 Mar 2008 19:01:09 +0100
changeset 6349 6aaf5b1d8f15
parent 6348 f8feaa665319
child 6350 6aa4a3fa4e60
child 6352 34e4f4ef4936
coverage: deal with symlinked input paths (MacOSX issue) /tmp is symlinked in MacOSX therefore test scripts as well as python modules are installed in a symlinked location. coverage.py uses abspath() to normalize its inputs which fails if these are referencing real paths. Use realpath() instead.
tests/coverage.py
--- a/tests/coverage.py	Sat Mar 22 18:01:46 2008 +0100
+++ b/tests/coverage.py	Sat Mar 22 19:01:09 2008 +0100
@@ -412,6 +412,9 @@
         else:
             omit = []
 
+        omit = [os.path.normcase(os.path.abspath(os.path.realpath(p)))
+                for p in omit]
+
         if settings.get('report'):
             self.report(args, show_missing, ignore_errors, omit_prefixes=omit)
         if settings.get('annotate'):
@@ -537,7 +540,7 @@
                     if os.path.exists(g):
                         f = g
                         break
-            cf = os.path.normcase(os.path.abspath(f))
+            cf = os.path.normcase(os.path.abspath(os.path.realpath(f)))
             self.canonical_filename_cache[filename] = cf
         return self.canonical_filename_cache[filename]