diff --git a/coverage/files.py b/coverage/files.py index 09f09da79..80cb3a047 100644 --- a/coverage/files.py +++ b/coverage/files.py @@ -343,6 +343,7 @@ def add(self, pattern, result): match an entire tree, and not just its root. """ + pattern = pattern.replace("\\", "/") pattern_sep = sep(pattern) if len(pattern) > 1: diff --git a/coverage/sqldata.py b/coverage/sqldata.py index 8d2ed73a5..ab7c437bb 100644 --- a/coverage/sqldata.py +++ b/coverage/sqldata.py @@ -384,6 +384,7 @@ def _file_id(self, filename, add=False): If filename is not in the database yet, add it if `add` is True. If `add` is not True, return None. """ + filename = filename.replace("\\", "/") if filename not in self._file_map: if add: with self._connect() as con: diff --git a/tests/test_files.py b/tests/test_files.py index 5588c373d..fa598896e 100644 --- a/tests/test_files.py +++ b/tests/test_files.py @@ -428,4 +428,4 @@ class WindowsFileTest(CoverageTest): run_in_temp_dir = False def test_actual_path(self): - assert actual_path(r'c:\Windows') == actual_path(r'C:\wINDOWS') + assert actual_path(r'c:/Windows') == actual_path(r'C:\wINDOWS')