wrap ContextVar more directly instead of Werkzeug LocalStack

This commit is contained in:
David Lord 2022-06-22 12:06:22 -07:00
parent ab36542260
commit af0feaa116
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
2 changed files with 59 additions and 30 deletions

View file

@ -323,12 +323,13 @@ def test_app_cli_has_app_context(app, runner):
# 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)
stack = _app_ctx_stack.var.get(None)
stack_size = stack is not None and len(stack) == 1
return same_app, stack_size, 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, True)
def test_with_appcontext(runner):