summaryrefslogtreecommitdiff
path: root/test
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
commitc4510325e6a1979daeca5ff5ff55bcf5db416524 (patch)
tree5d9f9c78d0a94480db541e321604f872b8f694e3 /test
parentca85f635d345ebcdd5fae5e235bd22573aa11e9a (diff)
downloadpython-coveragepy-c4510325e6a1979daeca5ff5ff55bcf5db416524.tar.gz
Fix #194: a file path could have its prefix twice.
Diffstat (limited to 'test')
-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 d45f597..ba8a06b 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."""