re-add flag to skip unguarded app.run from CLI

This commit is contained in:
David Lord 2022-06-29 21:11:58 -07:00
parent ab36542260
commit 5544d09477
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
3 changed files with 9 additions and 7 deletions

View file

@ -13,7 +13,6 @@ import pytest
from _pytest.monkeypatch import notset
from click.testing import CliRunner
from flask import _app_ctx_stack
from flask import Blueprint
from flask import current_app
from flask import Flask
@ -322,13 +321,11 @@ def test_app_cli_has_app_context(app, runner):
app = click.get_current_context().obj.load_app()
# the loaded app should be the same as current_app
same_app = current_app._get_current_object() is app
# only one app context should be pushed
stack_size = len(_app_ctx_stack._local.stack)
return same_app, stack_size, value
return same_app, value
cli = FlaskGroup(create_app=lambda: app)
result = runner.invoke(cli, ["check", "x"], standalone_mode=False)
assert result.return_value == (True, 1, True)
assert result.return_value == (True, True)
def test_with_appcontext(runner):