diff --git a/tests/integrations/django/test_basic.py b/tests/integrations/django/test_basic.py index eabe3fdd98..243431fdf5 100644 --- a/tests/integrations/django/test_basic.py +++ b/tests/integrations/django/test_basic.py @@ -72,7 +72,9 @@ def test_ensures_x_forwarded_header_is_honored_in_sdk_when_enabled_in_django( sentry_init(integrations=[DjangoIntegration()], send_default_pii=True) exceptions = capture_exceptions() events = capture_events() - unpack_werkzeug_response(client.get(reverse("view_exc"), headers={"X_FORWARDED_HOST": "example.com"})) + unpack_werkzeug_response( + client.get(reverse("view_exc"), headers={"X_FORWARDED_HOST": "example.com"}) + ) (error,) = exceptions assert isinstance(error, ZeroDivisionError) @@ -91,7 +93,9 @@ def test_ensures_x_forwarded_header_is_not_honored_when_unenabled_in_django( sentry_init(integrations=[DjangoIntegration()], send_default_pii=True) exceptions = capture_exceptions() events = capture_events() - unpack_werkzeug_response(client.get(reverse("view_exc"), headers={"X_FORWARDED_HOST": "example.com"})) + unpack_werkzeug_response( + client.get(reverse("view_exc"), headers={"X_FORWARDED_HOST": "example.com"}) + ) (error,) = exceptions assert isinstance(error, ZeroDivisionError) @@ -157,9 +161,7 @@ def test_has_trace_if_performance_enabled(sentry_init, client, capture_events): traces_sample_rate=1.0, ) events = capture_events() - response = client.head(reverse("view_exc_with_msg")) - # Close the response to ensure the WSGI cycle is complete and the transaction is finished - response.close() + unpack_werkzeug_response(client.head(reverse("view_exc_with_msg"))) (msg_event, error_event, transaction_event) = events @@ -215,11 +217,11 @@ def test_trace_from_headers_if_performance_enabled(sentry_init, client, capture_ trace_id = "582b43a4192642f0b136d5159a501701" sentry_trace_header = "{}-{}-{}".format(trace_id, "6e8f22c393e68f19", 1) - response = client.head( - reverse("view_exc_with_msg"), headers={"sentry-trace": sentry_trace_header} + unpack_werkzeug_response( + client.head( + reverse("view_exc_with_msg"), headers={"sentry-trace": sentry_trace_header} + ) ) - # Close the response to ensure the WSGI cycle is complete and the transaction is finished - response.close() (msg_event, error_event, transaction_event) = events diff --git a/tests/integrations/flask/test_flask.py b/tests/integrations/flask/test_flask.py index 4960e84704..e2c37aa5f7 100644 --- a/tests/integrations/flask/test_flask.py +++ b/tests/integrations/flask/test_flask.py @@ -989,7 +989,7 @@ def test_transaction_http_method_default( events = capture_events() client = app.test_client() - + response = client.get("/nomessage") assert response.status_code == 200 # Close the response to ensure the WSGI cycle is complete and the transaction is finished @@ -1033,7 +1033,7 @@ def test_transaction_http_method_custom( events = capture_events() client = app.test_client() - + response = client.get("/nomessage") assert response.status_code == 200 # Close the response to ensure the WSGI cycle is complete and the transaction is finished diff --git a/tests/integrations/strawberry/test_strawberry.py b/tests/integrations/strawberry/test_strawberry.py index 45e7940686..0aab78f443 100644 --- a/tests/integrations/strawberry/test_strawberry.py +++ b/tests/integrations/strawberry/test_strawberry.py @@ -199,7 +199,9 @@ def test_capture_request_if_available_and_send_pii_is_on( query = "query ErrorQuery { error }" # Close the response to ensure the WSGI cycle is complete and the transaction is finished - client.post("/graphql", json={"query": query, "operationName": "ErrorQuery"}).close() + client.post( + "/graphql", json={"query": query, "operationName": "ErrorQuery"} + ).close() assert len(events) == 1 @@ -255,7 +257,9 @@ def test_do_not_capture_request_if_send_pii_is_off( query = "query ErrorQuery { error }" # Close the response to ensure the WSGI cycle is complete and the transaction is finished - client.post("/graphql", json={"query": query, "operationName": "ErrorQuery"}).close() + client.post( + "/graphql", json={"query": query, "operationName": "ErrorQuery"} + ).close() assert len(events) == 1 @@ -336,7 +340,9 @@ def test_capture_transaction_on_error( query = "query ErrorQuery { error }" # Close the response to ensure the WSGI cycle is complete and the transaction is finished - client.post("/graphql", json={"query": query, "operationName": "ErrorQuery"}).close() + client.post( + "/graphql", json={"query": query, "operationName": "ErrorQuery"} + ).close() assert len(events) == 2 (_, transaction_event) = events @@ -414,7 +420,9 @@ def test_capture_transaction_on_success( query = "query GreetingQuery { hello }" # Close the response to ensure the WSGI cycle is complete and the transaction is finished - client.post("/graphql", json={"query": query, "operationName": "GreetingQuery"}).close() + client.post( + "/graphql", json={"query": query, "operationName": "GreetingQuery"} + ).close() assert len(events) == 1 (transaction_event,) = events @@ -725,7 +733,9 @@ def test_span_origin2( query = "query GreetingQuery { hello }" # Close the response to ensure the WSGI cycle is complete and the transaction is finished - client.post("/graphql", json={"query": query, "operationName": "GreetingQuery"}).close() + client.post( + "/graphql", json={"query": query, "operationName": "GreetingQuery"} + ).close() (event,) = events