diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2018-01-22 20:36:11 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2018-01-22 20:36:11 -0500 |
commit | 69debd440daab9155cc2b2243f29a8a48f4404f9 (patch) | |
tree | f862b8bc0b4cdab0a618d21c2899341ede2f586b /tests/test_files.py | |
parent | 2e9a5fd74f9a1fb7065dc0edc438cdc2da05b40c (diff) | |
download | python-coveragepy-git-69debd440daab9155cc2b2243f29a8a48f4404f9.tar.gz |
Ensure mapped paths use the separator of the result. #618
Diffstat (limited to 'tests/test_files.py')
-rw-r--r-- | tests/test_files.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/test_files.py b/tests/test_files.py index 84d84a4e..dd88b6eb 100644 --- a/tests/test_files.py +++ b/tests/test_files.py @@ -246,6 +246,38 @@ class PathAliasesTest(CoverageTest): aliases.add(r'c:\ned\src', r'.\mysrc') self.assert_mapped(aliases, r'/home/ned/foo/src/sub/a.py', r'.\mysrc\sub\a.py') + def test_windows_on_linux(self): + # https://bitbucket.org/ned/coveragepy/issues/618/problem-when-combining-windows-generated + lin = "*/project/module/" + win = "*\\project\\module\\" + + # Try the paths in both orders. + for paths in [[lin, win], [win, lin]]: + aliases = PathAliases() + for path in paths: + aliases.add(path, "project/module") + self.assert_mapped( + aliases, + "C:\\a\\path\\somewhere\\coveragepy_test\\project\\module\\tests\\file.py", + "project/module/tests/file.py" + ) + + def test_linux_on_windows(self): + # https://bitbucket.org/ned/coveragepy/issues/618/problem-when-combining-windows-generated + lin = "*/project/module/" + win = "*\\project\\module\\" + + # Try the paths in both orders. + for paths in [[lin, win], [win, lin]]: + aliases = PathAliases() + for path in paths: + aliases.add(path, "project\\module") + self.assert_mapped( + aliases, + "C:/a/path/somewhere/coveragepy_test/project/module/tests/file.py", + "project\\module\\tests\\file.py" + ) + def test_multiple_wildcard(self): aliases = PathAliases() aliases.add('/home/jenkins/*/a/*/b/*/django', './django') |