diff --git a/tests/test_apps/cliapp/syntaxerror/__init__.py b/tests/test_apps/cliapp/syntaxerror/__init__.py new file mode 100644 index 00000000..a4694fdb --- /dev/null +++ b/tests/test_apps/cliapp/syntaxerror/__init__.py @@ -0,0 +1 @@ +spam()spam() diff --git a/tests/test_cli.py b/tests/test_cli.py index 811ef0c8..693ff582 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -243,6 +243,15 @@ def test_locate_app_suppress_raise(): ) +def test_locate_app_init_syntax_error(test_apps): + info = ScriptInfo() + with pytest.raises(SyntaxError): + locate_app(info, 'cliapp.syntaxerror', None) + + with pytest.raises(SyntaxError): + locate_app(info, 'cliapp.syntaxerror', None) + + def test_get_version(test_apps, capsys): """Test of get_version.""" from flask import __version__ as flask_ver