@@ -144,6 +144,12 @@ def test_flat_rootname(original, flat):
144
144
["abc/foo/hi.py" , "ABC/foo/bar/hi.py" , r"ABC\foo/bar/hi.py" ],
145
145
["abcd/foo.py" , "xabc/hi.py" ],
146
146
),
147
+ (
148
+ ["*/foo" ], False , True ,
149
+ ["abc/foo/hi.py" , "foo/hi.py" ],
150
+ ["abc/xfoo/hi.py" ],
151
+ ),
152
+
147
153
])
148
154
def test_fnmatches_to_regex (patterns , case_insensitive , partial , matches , nomatches ):
149
155
regex = fnmatches_to_regex (patterns , case_insensitive = case_insensitive , partial = partial )
@@ -386,6 +392,30 @@ def test_linux_on_windows(self, paths, rel_yn):
386
392
"project\\ module\\ tests\\ file.py" ,
387
393
)
388
394
395
+ @pytest .mark .parametrize ("paths" , lin_win_paths )
396
+ def test_relative_windows_on_linux (self , paths ):
397
+ # https://github.com/nedbat/coveragepy/issues/991
398
+ aliases = PathAliases (relative = True )
399
+ for path in paths :
400
+ aliases .add (path , "project/module" )
401
+ self .assert_mapped (
402
+ aliases ,
403
+ r"project\module\tests\file.py" ,
404
+ r"project/module/tests/file.py" ,
405
+ )
406
+
407
+ @pytest .mark .parametrize ("paths" , lin_win_paths )
408
+ def test_relative_linux_on_windows (self , paths ):
409
+ # https://github.com/nedbat/coveragepy/issues/991
410
+ aliases = PathAliases (relative = True )
411
+ for path in paths :
412
+ aliases .add (path , r"project\module" )
413
+ self .assert_mapped (
414
+ aliases ,
415
+ r"project/module/tests/file.py" ,
416
+ r"project\module\tests\file.py" ,
417
+ )
418
+
389
419
def test_multiple_wildcard (self , rel_yn ):
390
420
aliases = PathAliases (relative = rel_yn )
391
421
aliases .add ('/home/jenkins/*/a/*/b/*/django' , './django' )
0 commit comments