Skip to content

Commit 8008a17

Browse files
committed
tests: normalize path separators in tests for Windows CI
1 parent c4aab3b commit 8008a17

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

tests/test_cli.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
from os.path import normpath
23
import signal
34
import subprocess
45
from subprocess import call
@@ -221,7 +222,7 @@ def test_cli_run_can_skip_writing_data(with_append, runner, tmpdir):
221222
'Parsing profile file %s.' % profile_file,
222223
'Name Stmts Miss Cover',
223224
'----------------------------------------------------------------',
224-
'tests/test_plugin/conditional_function.vim 13 5 62%']
225+
normpath('tests/test_plugin/conditional_function.vim') + ' 13 5 62%']
225226
assert not tmpdir.join(DEFAULT_COVERAGE_DATA_FILE).exists()
226227

227228

@@ -267,7 +268,7 @@ def test_cli_run_report_fd(capfd, tmpdir, devnull):
267268
assert out.splitlines() == [
268269
'Name Stmts Miss Cover',
269270
'----------------------------------------------------------------',
270-
'tests/test_plugin/conditional_function.vim 13 5 62%']
271+
normpath('tests/test_plugin/conditional_function.vim') + ' 13 5 62%']
271272
assert err.splitlines() == [
272273
'Running cmd: true (in %s)' % str(os.getcwd()),
273274
'Parsing profile file %s.' % tmp_profile_fname,
@@ -286,7 +287,7 @@ def test_cli_run_report_fd(capfd, tmpdir, devnull):
286287
assert open(ofname).read().splitlines() == [
287288
'Name Stmts Miss Cover',
288289
'----------------------------------------------------------------',
289-
'tests/test_plugin/conditional_function.vim 13 5 62%']
290+
normpath('tests/test_plugin/conditional_function.vim') + ' 13 5 62%']
290291

291292

292293
def test_cli_call(capfd):
@@ -511,7 +512,7 @@ def test_report_profile_or_data_file(runner, tmpdir):
511512
assert result.output.splitlines() == [
512513
'Name Stmts Miss Cover',
513514
'---------------------------------------------------------------',
514-
'tests/test_plugin/merged_conditionals.vim 19 12 37%']
515+
normpath('tests/test_plugin/merged_conditionals.vim') + ' 19 12 37%']
515516
assert result.exit_code == 0
516517

517518

@@ -553,7 +554,7 @@ def test_report_source(runner, tmpdir, devnull):
553554
)
554555
assert result.exit_code == 2
555556

556-
fname = "foo/bar/test.vim"
557+
fname = normpath("foo/bar/test.vim")
557558
tmpdir.join(fname).ensure().write("echom 1")
558559
tmpdir.join("foo/bar/test2.vim").ensure().write("echom 2")
559560
result = runner.invoke(cli.main, ["report", "--source", ".", devnull.name])
@@ -591,7 +592,7 @@ def test_report_source(runner, tmpdir, devnull):
591592
== [
592593
"Name Stmts Miss Cover",
593594
"---------------------------------------------------------------",
594-
"tests/test_plugin/merged_conditionals.vim 19 12 37%",
595+
normpath("tests/test_plugin/merged_conditionals.vim") + " 19 12 37%",
595596
]
596597
)
597598
assert result.exit_code == 0
@@ -609,8 +610,8 @@ def test_cli_xml(runner, tmpdir):
609610

610611
with open('coverage.xml') as f:
611612
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
614615

615616
# --rcfile is used.
616617
coveragerc = 'customrc'
@@ -624,8 +625,8 @@ def test_cli_xml(runner, tmpdir):
624625
assert result.exit_code == 0
625626
with open('custom.xml') as f:
626627
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
629630

630631
# --rcfile is used.
631632
coveragerc = 'customrc'
@@ -722,7 +723,7 @@ def run_args(profile_file):
722723
'Writing coverage file .coverage_covimerage.',
723724
'Name Stmts Miss Cover',
724725
'----------------------------------------------------------------',
725-
'tests/test_plugin/conditional_function.vim 13 5 62%']
726+
normpath('tests/test_plugin/conditional_function.vim') + ' 13 5 62%']
726727
assert result.exit_code == 0
727728

728729
assert open('.coverage_covimerage').read().startswith(covdata_header)
@@ -735,7 +736,7 @@ def run_args(profile_file):
735736
'Writing coverage file .coverage_covimerage.',
736737
'Name Stmts Miss Cover',
737738
'----------------------------------------------------------------',
738-
'tests/test_plugin/conditional_function.vim 13 5 62%']
739+
normpath('tests/test_plugin/conditional_function.vim') + ' 13 5 62%']
739740
assert result.exit_code == 0
740741

741742
# Append another profile.
@@ -753,8 +754,8 @@ def run_args(profile_file):
753754
'Writing coverage file .coverage_covimerage.',
754755
'Name Stmts Miss Cover',
755756
'----------------------------------------------------------------',
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%',
758759
'----------------------------------------------------------------',
759760
'TOTAL 32 17 47%']
760761
assert result.exit_code == 0

0 commit comments

Comments
 (0)