Browse Source

Add test to showcase that printing a traceback works

pull/2209/head
Sven-Hendrik Haase 8 years ago
parent
commit
ed17bc1710
  1. 17
      tests/test_cli.py

17
tests/test_cli.py

@ -191,3 +191,20 @@ def test_flaskgroup():
result = runner.invoke(cli, ['test'])
assert result.exit_code == 0
assert result.output == 'flaskgroup\n'
def test_print_exceptions():
"""Print the stacktrace if the CLI."""
def create_app(info):
raise Exception("oh no")
return Flask("flaskgroup")
@click.group(cls=FlaskGroup, create_app=create_app)
def cli(**params):
pass
runner = CliRunner()
result = runner.invoke(cli, ['--help'])
assert result.exit_code == 0
assert 'Exception: oh no' in result.output
assert 'Traceback' in result.output

Loading…
Cancel
Save