[pre-commit.ci lite] apply automatic fixes
This commit is contained in:
parent
4d29df4361
commit
8ccd430e79
1 changed files with 8 additions and 4 deletions
|
|
@ -235,10 +235,12 @@ class TestNoImports:
|
||||||
|
|
||||||
class TestStreaming:
|
class TestStreaming:
|
||||||
def test_stream_with_context_fails_with_async_route(self):
|
def test_stream_with_context_fails_with_async_route(self):
|
||||||
import flask
|
|
||||||
import pytest
|
|
||||||
import gc
|
import gc
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
import flask
|
||||||
|
|
||||||
app = flask.Flask(__name__)
|
app = flask.Flask(__name__)
|
||||||
|
|
||||||
@app.route("/stream")
|
@app.route("/stream")
|
||||||
|
|
@ -246,17 +248,19 @@ class TestStreaming:
|
||||||
@flask.stream_with_context
|
@flask.stream_with_context
|
||||||
def generate():
|
def generate():
|
||||||
yield "hello"
|
yield "hello"
|
||||||
|
|
||||||
return flask.Response(generate())
|
return flask.Response(generate())
|
||||||
|
|
||||||
with app.test_request_context("/stream"):
|
with app.test_request_context("/stream"):
|
||||||
with pytest.raises(RuntimeError, match="Install Flask with the 'async' extra"):
|
with pytest.raises(
|
||||||
|
RuntimeError, match="Install Flask with the 'async' extra"
|
||||||
|
):
|
||||||
# This forces Flask to run the async view and raise the RuntimeError
|
# This forces Flask to run the async view and raise the RuntimeError
|
||||||
app.ensure_sync(app.view_functions["stream"])()
|
app.ensure_sync(app.view_functions["stream"])()
|
||||||
|
|
||||||
# Clean up coroutine warnings
|
# Clean up coroutine warnings
|
||||||
gc.collect()
|
gc.collect()
|
||||||
|
|
||||||
|
|
||||||
def test_streaming_with_context_as_decorator(self, app, client):
|
def test_streaming_with_context_as_decorator(self, app, client):
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
def index():
|
def index():
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue