forked from orbit-oss/flask
add test for lazy loading error
This commit is contained in:
parent
aa6dd09c2c
commit
2305b056c3
1 changed files with 17 additions and 4 deletions
|
|
@ -311,6 +311,23 @@ def test_scriptinfo(test_apps, monkeypatch):
|
||||||
assert app.name == "testapp"
|
assert app.name == "testapp"
|
||||||
|
|
||||||
|
|
||||||
|
def test_lazy_load_error(monkeypatch):
|
||||||
|
"""When using lazy loading, the correct exception should be
|
||||||
|
re-raised.
|
||||||
|
"""
|
||||||
|
|
||||||
|
class BadExc(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def bad_load():
|
||||||
|
raise BadExc
|
||||||
|
|
||||||
|
lazy = DispatchingApp(bad_load, use_eager_loading=False)
|
||||||
|
|
||||||
|
with pytest.raises(BadExc):
|
||||||
|
lazy._flush_bg_loading_exception()
|
||||||
|
|
||||||
|
|
||||||
def test_with_appcontext(runner):
|
def test_with_appcontext(runner):
|
||||||
@click.command()
|
@click.command()
|
||||||
@with_appcontext
|
@with_appcontext
|
||||||
|
|
@ -660,7 +677,3 @@ def test_click_7_deprecated():
|
||||||
pytest.deprecated_call(cli_main, match=".* Click 7 is deprecated")
|
pytest.deprecated_call(cli_main, match=".* Click 7 is deprecated")
|
||||||
else:
|
else:
|
||||||
cli_main()
|
cli_main()
|
||||||
|
|
||||||
|
|
||||||
def test_load_in_background():
|
|
||||||
pytest.raises(Exception, DispatchingApp, "appname123")
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue