Skip to content

Commit

Permalink
tests: fix command outputs includes \r\n on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd committed Jan 30, 2020
1 parent 8008a17 commit a4bf2e2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
from covimerage.cli import get_version_message


NEWLINE = '\n' if os.platform != 'win32' else '\r\n'


def test_dunder_main_run(capfd):
assert call([sys.executable, '-m', 'covimerage']) == 0
out, err = capfd.readouterr()
Expand Down Expand Up @@ -293,7 +296,7 @@ def test_cli_run_report_fd(capfd, tmpdir, devnull):
def test_cli_call(capfd):
assert call(['covimerage', '--version']) == 0
out, err = capfd.readouterr()
assert out == get_version_message() + '\n'
assert out == get_version_message() + NEWLINE

assert call(['covimerage', '--help']) == 0
out, err = capfd.readouterr()
Expand Down Expand Up @@ -354,7 +357,7 @@ def test_cli_call_verbosity_fd(capfd):
assert call(['covimerage', '-qq', 'write_coverage', os.devnull]) == 1
out, err = capfd.readouterr()
assert out == ''
assert err == 'Error: No data to report.\n'
assert err == 'Error: No data to report.' + NEWLINE


def test_cli_writecoverage_without_data(runner):
Expand Down Expand Up @@ -662,7 +665,7 @@ def test_run_handles_exit_code_from_python_fd(capfd):
'python', '-c', 'print("output"); import sys; sys.exit(42)'])
out, err = capfd.readouterr()
assert 'Error: Command exited non-zero: 42.' in err.splitlines()
assert out == 'output\n'
assert out == 'output' + NEWLINE
assert ret == 42


Expand Down

0 comments on commit a4bf2e2

Please sign in to comment.