diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2015-01-25 19:08:04 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2015-01-25 19:08:04 -0500 |
commit | 9cda91b74699517695246f87438ddd2681726f74 (patch) | |
tree | a1df1cac27f25e2052102b8059a2cfa4a185bbb7 | |
parent | ee5004ff51d1f86b01fff56ae867f39790c3f98f (diff) | |
download | python-coveragepy-git-9cda91b74699517695246f87438ddd2681726f74.tar.gz |
Keep windows working
-rw-r--r-- | coverage/plugin.py | 5 | ||||
-rw-r--r-- | tests/test_xml.py | 8 |
2 files changed, 10 insertions, 3 deletions
diff --git a/coverage/plugin.py b/coverage/plugin.py index bd997ac3..20d7ee8f 100644 --- a/coverage/plugin.py +++ b/coverage/plugin.py @@ -1,5 +1,6 @@ """Plugin interfaces for coverage.py""" +import os import re from coverage.misc import _needs_to_implement @@ -240,5 +241,5 @@ class FileReporter(object): For example, the file a/b/c.py will return 'a_b_c_py' """ - # TODO: a better generic implementation? - return re.sub(r"[\/.:]", "_", self.name) + name = os.path.splitdrive(self.name)[1] + return re.sub(r"[\\/.:]", "_", name) diff --git a/tests/test_xml.py b/tests/test_xml.py index d7611ebf..b9b36efb 100644 --- a/tests/test_xml.py +++ b/tests/test_xml.py @@ -238,8 +238,14 @@ def re_line(text, pat): def clean(text, scrub=None): - """Remove any text matching `scrub`, and all leading whitespace.""" + """Clean text to prepare it for comparison. + + Remove text matching `scrub`, and leading whitespace. Convert backslashes + to forward slashes. + + """ if scrub: text = re.sub(scrub, "", text) text = re.sub(r"(?m)^\s+", "", text) + text = re.sub(r"\\", "/", text) return text |