Support calling with_appcontext decorator with parenthesis
Calling without parenthesis still works the same. Just to have a bit more parity with Quart.
This commit is contained in:
parent
900e11850a
commit
8d62f5e8c6
3 changed files with 23 additions and 2 deletions
|
|
@ -341,6 +341,19 @@ def test_with_appcontext(runner):
|
|||
assert result.output == "testapp\n"
|
||||
|
||||
|
||||
def test_with_appcontext_parenthesis(runner):
|
||||
@click.command()
|
||||
@with_appcontext()
|
||||
def testcmd():
|
||||
click.echo(current_app.name)
|
||||
|
||||
obj = ScriptInfo(create_app=lambda: Flask("testapp"))
|
||||
|
||||
result = runner.invoke(testcmd, obj=obj)
|
||||
assert result.exit_code == 0
|
||||
assert result.output == "testapp\n"
|
||||
|
||||
|
||||
def test_appgroup_app_context(runner):
|
||||
@click.group(cls=AppGroup)
|
||||
def cli():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue