summaryrefslogtreecommitdiff
path: root/test/test_files.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2012-09-08 09:09:46 -0400
committerNed Batchelder <ned@nedbatchelder.com>2012-09-08 09:09:46 -0400
commitb9c2a36f26f27b25fa4b5e37660a257d5c79700b (patch)
tree2bd37f709d89210558c818413ff53b5eb9bf17a7 /test/test_files.py
parent825acb3051853f0ac849df5bc15920ba932391e1 (diff)
downloadpython-coveragepy-git-b9c2a36f26f27b25fa4b5e37660a257d5c79700b.tar.gz
Fix #194: a file path could have its prefix twice.
Diffstat (limited to 'test/test_files.py')
-rw-r--r--test/test_files.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/test_files.py b/test/test_files.py
index d45f5973..ba8a06ba 100644
--- a/test/test_files.py
+++ b/test/test_files.py
@@ -37,6 +37,13 @@ class FileLocatorTest(CoverageTest):
self.assertEqual(fl.relative_filename(a1), "file1.py")
self.assertEqual(fl.relative_filename(a2), a2)
+ def test_filepath_contains_absolute_prefix_twice(self):
+ # https://bitbucket.org/ned/coveragepy/issue/194/filelocatorrelative_filename-could-mangle
+ fl = FileLocator()
+ d = fl.abs_file(os.curdir)
+ rel = os.path.join('sub', d.lstrip(os.path.sep), 'file1.py')
+ self.assertEqual(fl.relative_filename(fl.abs_file(rel)), rel)
+
class MatcherTest(CoverageTest):
"""Tests of file matchers."""