Skip to content

Commit

Permalink
Fix test_run_cmd_requires_args
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed committed Sep 11, 2021
1 parent 53c7cc1 commit 0b505f4
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@
from covimerage.cli import get_version_message


def format_click_arg(name):
if click.__version__ < '7.0':
return '"{}"'.format(name)
elif click.__version__ < '7.1':
return '"{}..."'.format(name.upper())
else:
return "'{}...'".format(name.upper())


def test_dunder_main_run(capfd):
assert call([sys.executable, '-m', 'covimerage']) == 0
out, err = capfd.readouterr()
Expand Down Expand Up @@ -795,9 +804,10 @@ def test_run_forwards_sighup(devnull):

def test_run_cmd_requires_args(runner):
result = runner.invoke(cli.run, [])
assert 'Error: Missing argument "%s".' % (
'args' if click.__version__ < '7.0' else 'ARGS...',
) in result.output.splitlines()
assert (
'Error: Missing argument {}.'.format(format_click_arg('args'))
in result.output.splitlines()
)
assert result.exit_code == 2


Expand Down

0 comments on commit 0b505f4

Please sign in to comment.