1
1
import os
2
+ from os .path import normpath
2
3
import signal
3
4
import subprocess
4
5
from subprocess import call
@@ -221,7 +222,7 @@ def test_cli_run_can_skip_writing_data(with_append, runner, tmpdir):
221
222
'Parsing profile file %s.' % profile_file ,
222
223
'Name Stmts Miss Cover' ,
223
224
'----------------------------------------------------------------' ,
224
- 'tests/test_plugin/conditional_function.vim 13 5 62%' ]
225
+ normpath ( 'tests/test_plugin/conditional_function.vim' ) + ' 13 5 62%' ]
225
226
assert not tmpdir .join (DEFAULT_COVERAGE_DATA_FILE ).exists ()
226
227
227
228
@@ -267,7 +268,7 @@ def test_cli_run_report_fd(capfd, tmpdir, devnull):
267
268
assert out .splitlines () == [
268
269
'Name Stmts Miss Cover' ,
269
270
'----------------------------------------------------------------' ,
270
- 'tests/test_plugin/conditional_function.vim 13 5 62%' ]
271
+ normpath ( 'tests/test_plugin/conditional_function.vim' ) + ' 13 5 62%' ]
271
272
assert err .splitlines () == [
272
273
'Running cmd: true (in %s)' % str (os .getcwd ()),
273
274
'Parsing profile file %s.' % tmp_profile_fname ,
@@ -286,7 +287,7 @@ def test_cli_run_report_fd(capfd, tmpdir, devnull):
286
287
assert open (ofname ).read ().splitlines () == [
287
288
'Name Stmts Miss Cover' ,
288
289
'----------------------------------------------------------------' ,
289
- 'tests/test_plugin/conditional_function.vim 13 5 62%' ]
290
+ normpath ( 'tests/test_plugin/conditional_function.vim' ) + ' 13 5 62%' ]
290
291
291
292
292
293
def test_cli_call (capfd ):
@@ -511,7 +512,7 @@ def test_report_profile_or_data_file(runner, tmpdir):
511
512
assert result .output .splitlines () == [
512
513
'Name Stmts Miss Cover' ,
513
514
'---------------------------------------------------------------' ,
514
- 'tests/test_plugin/merged_conditionals.vim 19 12 37%' ]
515
+ normpath ( 'tests/test_plugin/merged_conditionals.vim' ) + ' 19 12 37%' ]
515
516
assert result .exit_code == 0
516
517
517
518
@@ -553,7 +554,7 @@ def test_report_source(runner, tmpdir, devnull):
553
554
)
554
555
assert result .exit_code == 2
555
556
556
- fname = "foo/bar/test.vim"
557
+ fname = normpath ( "foo/bar/test.vim" )
557
558
tmpdir .join (fname ).ensure ().write ("echom 1" )
558
559
tmpdir .join ("foo/bar/test2.vim" ).ensure ().write ("echom 2" )
559
560
result = runner .invoke (cli .main , ["report" , "--source" , "." , devnull .name ])
@@ -591,7 +592,7 @@ def test_report_source(runner, tmpdir, devnull):
591
592
== [
592
593
"Name Stmts Miss Cover" ,
593
594
"---------------------------------------------------------------" ,
594
- "tests/test_plugin/merged_conditionals.vim 19 12 37%" ,
595
+ normpath ( "tests/test_plugin/merged_conditionals.vim" ) + " 19 12 37%" ,
595
596
]
596
597
)
597
598
assert result .exit_code == 0
@@ -609,8 +610,8 @@ def test_cli_xml(runner, tmpdir):
609
610
610
611
with open ('coverage.xml' ) as f :
611
612
xml = f .read ()
612
- assert 'filename="%s/tests/test_plugin/merged_conditionals.vim ' % (
613
- old_cwd ) in xml
613
+ assert 'filename="%s' % (
614
+ old_cwd . join ( '/tests/test_plugin/merged_conditionals.vim' ) ) in xml
614
615
615
616
# --rcfile is used.
616
617
coveragerc = 'customrc'
@@ -624,8 +625,8 @@ def test_cli_xml(runner, tmpdir):
624
625
assert result .exit_code == 0
625
626
with open ('custom.xml' ) as f :
626
627
xml = f .read ()
627
- assert 'filename="%s/tests/test_plugin/merged_conditionals.vim ' % (
628
- old_cwd ) in xml
628
+ assert 'filename="%s' % (
629
+ old_cwd . join ( '/tests/test_plugin/merged_conditionals.vim' ) ) in xml
629
630
630
631
# --rcfile is used.
631
632
coveragerc = 'customrc'
@@ -722,7 +723,7 @@ def run_args(profile_file):
722
723
'Writing coverage file .coverage_covimerage.' ,
723
724
'Name Stmts Miss Cover' ,
724
725
'----------------------------------------------------------------' ,
725
- 'tests/test_plugin/conditional_function.vim 13 5 62%' ]
726
+ normpath ( 'tests/test_plugin/conditional_function.vim' ) + ' 13 5 62%' ]
726
727
assert result .exit_code == 0
727
728
728
729
assert open ('.coverage_covimerage' ).read ().startswith (covdata_header )
@@ -735,7 +736,7 @@ def run_args(profile_file):
735
736
'Writing coverage file .coverage_covimerage.' ,
736
737
'Name Stmts Miss Cover' ,
737
738
'----------------------------------------------------------------' ,
738
- 'tests/test_plugin/conditional_function.vim 13 5 62%' ]
739
+ normpath ( 'tests/test_plugin/conditional_function.vim' ) + ' 13 5 62%' ]
739
740
assert result .exit_code == 0
740
741
741
742
# Append another profile.
@@ -753,8 +754,8 @@ def run_args(profile_file):
753
754
'Writing coverage file .coverage_covimerage.' ,
754
755
'Name Stmts Miss Cover' ,
755
756
'----------------------------------------------------------------' ,
756
- 'tests/test_plugin/conditional_function.vim 13 5 62%' ,
757
- 'tests/test_plugin/merged_conditionals.vim 19 12 37%' ,
757
+ normpath ( 'tests/test_plugin/conditional_function.vim' ) + ' 13 5 62%' ,
758
+ normpath ( 'tests/test_plugin/merged_conditionals.vim' ) + ' 19 12 37%' ,
758
759
'----------------------------------------------------------------' ,
759
760
'TOTAL 32 17 47%' ]
760
761
assert result .exit_code == 0
0 commit comments