From 8ccd430e79dd20f3cd151cdd7e7a4eeb30b04fc3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Wed, 16 Jul 2025 07:57:44 +0000 Subject: [PATCH] [pre-commit.ci lite] apply automatic fixes --- tests/test_helpers.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/test_helpers.py b/tests/test_helpers.py index da49bfc0..a466a0f9 100644 --- a/tests/test_helpers.py +++ b/tests/test_helpers.py @@ -235,10 +235,12 @@ class TestNoImports: class TestStreaming: def test_stream_with_context_fails_with_async_route(self): - import flask - import pytest import gc + import pytest + + import flask + app = flask.Flask(__name__) @app.route("/stream") @@ -246,17 +248,19 @@ class TestStreaming: @flask.stream_with_context def generate(): yield "hello" + return flask.Response(generate()) 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 app.ensure_sync(app.view_functions["stream"])() # Clean up coroutine warnings gc.collect() - def test_streaming_with_context_as_decorator(self, app, client): @app.route("/") def index():