Skip to content

Commit c612326

Browse files
committed
Cleanup
1 parent 22d72f0 commit c612326

File tree

3 files changed

+28
-16
lines changed

3 files changed

+28
-16
lines changed

tests/integrations/django/test_basic.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ def test_ensures_x_forwarded_header_is_honored_in_sdk_when_enabled_in_django(
7272
sentry_init(integrations=[DjangoIntegration()], send_default_pii=True)
7373
exceptions = capture_exceptions()
7474
events = capture_events()
75-
unpack_werkzeug_response(client.get(reverse("view_exc"), headers={"X_FORWARDED_HOST": "example.com"}))
75+
unpack_werkzeug_response(
76+
client.get(reverse("view_exc"), headers={"X_FORWARDED_HOST": "example.com"})
77+
)
7678

7779
(error,) = exceptions
7880
assert isinstance(error, ZeroDivisionError)
@@ -91,7 +93,9 @@ def test_ensures_x_forwarded_header_is_not_honored_when_unenabled_in_django(
9193
sentry_init(integrations=[DjangoIntegration()], send_default_pii=True)
9294
exceptions = capture_exceptions()
9395
events = capture_events()
94-
unpack_werkzeug_response(client.get(reverse("view_exc"), headers={"X_FORWARDED_HOST": "example.com"}))
96+
unpack_werkzeug_response(
97+
client.get(reverse("view_exc"), headers={"X_FORWARDED_HOST": "example.com"})
98+
)
9599

96100
(error,) = exceptions
97101
assert isinstance(error, ZeroDivisionError)
@@ -157,9 +161,7 @@ def test_has_trace_if_performance_enabled(sentry_init, client, capture_events):
157161
traces_sample_rate=1.0,
158162
)
159163
events = capture_events()
160-
response = client.head(reverse("view_exc_with_msg"))
161-
# Close the response to ensure the WSGI cycle is complete and the transaction is finished
162-
response.close()
164+
unpack_werkzeug_response(client.head(reverse("view_exc_with_msg")))
163165

164166
(msg_event, error_event, transaction_event) = events
165167

@@ -215,11 +217,11 @@ def test_trace_from_headers_if_performance_enabled(sentry_init, client, capture_
215217
trace_id = "582b43a4192642f0b136d5159a501701"
216218
sentry_trace_header = "{}-{}-{}".format(trace_id, "6e8f22c393e68f19", 1)
217219

218-
response = client.head(
219-
reverse("view_exc_with_msg"), headers={"sentry-trace": sentry_trace_header}
220+
unpack_werkzeug_response(
221+
client.head(
222+
reverse("view_exc_with_msg"), headers={"sentry-trace": sentry_trace_header}
223+
)
220224
)
221-
# Close the response to ensure the WSGI cycle is complete and the transaction is finished
222-
response.close()
223225

224226
(msg_event, error_event, transaction_event) = events
225227

tests/integrations/flask/test_flask.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ def test_transaction_http_method_default(
989989
events = capture_events()
990990

991991
client = app.test_client()
992-
992+
993993
response = client.get("/nomessage")
994994
assert response.status_code == 200
995995
# 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(
10331033
events = capture_events()
10341034

10351035
client = app.test_client()
1036-
1036+
10371037
response = client.get("/nomessage")
10381038
assert response.status_code == 200
10391039
# Close the response to ensure the WSGI cycle is complete and the transaction is finished

tests/integrations/strawberry/test_strawberry.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,9 @@ def test_capture_request_if_available_and_send_pii_is_on(
199199

200200
query = "query ErrorQuery { error }"
201201
# Close the response to ensure the WSGI cycle is complete and the transaction is finished
202-
client.post("/graphql", json={"query": query, "operationName": "ErrorQuery"}).close()
202+
client.post(
203+
"/graphql", json={"query": query, "operationName": "ErrorQuery"}
204+
).close()
203205

204206
assert len(events) == 1
205207

@@ -255,7 +257,9 @@ def test_do_not_capture_request_if_send_pii_is_off(
255257

256258
query = "query ErrorQuery { error }"
257259
# Close the response to ensure the WSGI cycle is complete and the transaction is finished
258-
client.post("/graphql", json={"query": query, "operationName": "ErrorQuery"}).close()
260+
client.post(
261+
"/graphql", json={"query": query, "operationName": "ErrorQuery"}
262+
).close()
259263

260264
assert len(events) == 1
261265

@@ -336,7 +340,9 @@ def test_capture_transaction_on_error(
336340

337341
query = "query ErrorQuery { error }"
338342
# Close the response to ensure the WSGI cycle is complete and the transaction is finished
339-
client.post("/graphql", json={"query": query, "operationName": "ErrorQuery"}).close()
343+
client.post(
344+
"/graphql", json={"query": query, "operationName": "ErrorQuery"}
345+
).close()
340346

341347
assert len(events) == 2
342348
(_, transaction_event) = events
@@ -414,7 +420,9 @@ def test_capture_transaction_on_success(
414420

415421
query = "query GreetingQuery { hello }"
416422
# Close the response to ensure the WSGI cycle is complete and the transaction is finished
417-
client.post("/graphql", json={"query": query, "operationName": "GreetingQuery"}).close()
423+
client.post(
424+
"/graphql", json={"query": query, "operationName": "GreetingQuery"}
425+
).close()
418426

419427
assert len(events) == 1
420428
(transaction_event,) = events
@@ -725,7 +733,9 @@ def test_span_origin2(
725733

726734
query = "query GreetingQuery { hello }"
727735
# Close the response to ensure the WSGI cycle is complete and the transaction is finished
728-
client.post("/graphql", json={"query": query, "operationName": "GreetingQuery"}).close()
736+
client.post(
737+
"/graphql", json={"query": query, "operationName": "GreetingQuery"}
738+
).close()
729739

730740
(event,) = events
731741

0 commit comments

Comments
 (0)