diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2015-07-26 22:51:26 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2015-07-26 22:51:26 -0400 |
commit | 7b2590ee8013fc45276393495887bc8b039a3b0a (patch) | |
tree | 137105077e4b07b96bb61d5256dd525fd388df41 | |
parent | dffe029fd2118edb145916c9f706af6522bd6274 (diff) | |
download | python-coveragepy-git-7b2590ee8013fc45276393495887bc8b039a3b0a.tar.gz |
Windows fixes due to data changes
-rw-r--r-- | coverage/files.py | 5 | ||||
-rw-r--r-- | tests/test_concurrency.py | 3 |
2 files changed, 6 insertions, 2 deletions
diff --git a/coverage/files.py b/coverage/files.py index bc9b0c9a..e3ebd6ce 100644 --- a/coverage/files.py +++ b/coverage/files.py @@ -12,6 +12,7 @@ import re import sys from coverage import env +from coverage.backward import unicode_class from coverage.misc import CoverageException, join_regex @@ -73,6 +74,8 @@ if env.WINDOWS: def actual_path(path): """Get the actual path of `path`, including the correct case.""" + if env.PY2 and isinstance(path, unicode_class): + path = path.encode(sys.getfilesystemencoding()) if path in _ACTUAL_PATH_CACHE: return _ACTUAL_PATH_CACHE[path] @@ -84,7 +87,7 @@ if env.WINDOWS: actpath = tail else: head = actual_path(head) - if head in _ACTUAL_PATH_LIST_CACHE: + if head in _ACTUAL_PATH_LIST_CACHE: files = _ACTUAL_PATH_LIST_CACHE[head] else: try: diff --git a/tests/test_concurrency.py b/tests/test_concurrency.py index 3c338980..5fe91b98 100644 --- a/tests/test_concurrency.py +++ b/tests/test_concurrency.py @@ -9,6 +9,7 @@ import threading import coverage from coverage import env +from coverage.files import abs_file from tests.coveragetest import CoverageTest @@ -151,7 +152,7 @@ class ConcurrencyTest(CoverageTest): data.read_file(".coverage") # If the test fails, it's helpful to see this info: - fname = os.path.abspath("try_it.py") + fname = abs_file("try_it.py") linenos = data.lines(fname) print("{0}: {1}".format(len(linenos), linenos)) print_simple_annotation(code, linenos) |