Skip to content

Commit 5a3f14d

Browse files
committed
Fix this test on windows.
1 parent 56436f2 commit 5a3f14d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/test_files.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,13 @@ def test_peer_directories(self):
3939

4040
def test_filepath_contains_absolute_prefix_twice(self):
4141
# https://bitbucket.org/ned/coveragepy/issue/194/filelocatorrelative_filename-could-mangle
42+
# Build a path that has two pieces matching the absolute path prefix.
43+
# Technically, this test doesn't do that on Windows, but drive
44+
# letters make that impractical to acheive.
4245
fl = FileLocator()
4346
d = fl.abs_file(os.curdir)
44-
rel = os.path.join('sub', d.lstrip(os.path.sep), 'file1.py')
47+
trick = os.path.splitdrive(d)[1].lstrip(os.path.sep)
48+
rel = os.path.join('sub', trick, 'file1.py')
4549
self.assertEqual(fl.relative_filename(fl.abs_file(rel)), rel)
4650

4751

0 commit comments

Comments
 (0)