Add test to showcase that printing a traceback works
This commit is contained in:
parent
ad42d88fb2
commit
ed17bc1710
1 changed files with 17 additions and 0 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue