Skip to content

Commit 12860c2

Browse files
committed
More windows tweaking.
1 parent f408a88 commit 12860c2

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

coverage/files.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@ def add(self, pattern, result):
168168
regex_pat = fnmatch.translate(pattern).replace(r'\Z(', '(')
169169
if regex_pat.endswith("$"):
170170
regex_pat = regex_pat[:-1]
171+
# We want */a/b.py to match on Windows to, so change slash to match
172+
# either separator.
173+
regex_pat = regex_pat.replace(r"\/", r"[\\/]")
174+
# We want case-insensitive matching, so add that flag.
171175
regex = re.compile("(?i)" + regex_pat)
172176

173177
# Normalize the result: it must end with a path separator.

test/test_process.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,10 @@ def test_combine_with_aliases(self):
173173
# files have been combined together.
174174
data = coverage.CoverageData()
175175
data.read_file(".coverage")
176-
self.assertEqual(data.summary(fullpath=True), {'src/x.py': 6})
176+
summary = data.summary(fullpath=True)
177+
self.assertEqual(len(summary), 1)
178+
self.assertEqual(summary.keys()[0], os.path.normpath('src/x.py'))
179+
self.assertEqual(summary.values()[0], 6)
177180

178181
def test_missing_source_file(self):
179182
# Check what happens if the source is missing when reporting happens.

0 commit comments

Comments
 (0)