@@ -198,6 +198,7 @@ def test_capture_request_if_available_and_send_pii_is_on(
198198 client = client_factory (schema )
199199
200200 query = "query ErrorQuery { error }"
201+ # Close the response to ensure the WSGI cycle is complete and the transaction is finished
201202 client .post ("/graphql" , json = {"query" : query , "operationName" : "ErrorQuery" }).close ()
202203
203204 assert len (events ) == 1
@@ -253,6 +254,7 @@ def test_do_not_capture_request_if_send_pii_is_off(
253254 client = client_factory (schema )
254255
255256 query = "query ErrorQuery { error }"
257+ # Close the response to ensure the WSGI cycle is complete and the transaction is finished
256258 client .post ("/graphql" , json = {"query" : query , "operationName" : "ErrorQuery" }).close ()
257259
258260 assert len (events ) == 1
@@ -293,6 +295,7 @@ def test_breadcrumb_no_operation_name(
293295 client = client_factory (schema )
294296
295297 query = "{ error }"
298+ # Close the response to ensure the WSGI cycle is complete and the transaction is finished
296299 client .post ("/graphql" , json = {"query" : query }).close ()
297300
298301 assert len (events ) == 1
@@ -332,6 +335,7 @@ def test_capture_transaction_on_error(
332335 client = client_factory (schema )
333336
334337 query = "query ErrorQuery { error }"
338+ # Close the response to ensure the WSGI cycle is complete and the transaction is finished
335339 client .post ("/graphql" , json = {"query" : query , "operationName" : "ErrorQuery" }).close ()
336340
337341 assert len (events ) == 2
@@ -409,6 +413,7 @@ def test_capture_transaction_on_success(
409413 client = client_factory (schema )
410414
411415 query = "query GreetingQuery { hello }"
416+ # Close the response to ensure the WSGI cycle is complete and the transaction is finished
412417 client .post ("/graphql" , json = {"query" : query , "operationName" : "GreetingQuery" }).close ()
413418
414419 assert len (events ) == 1
@@ -486,6 +491,7 @@ def test_transaction_no_operation_name(
486491 client = client_factory (schema )
487492
488493 query = "{ hello }"
494+ # Close the response to ensure the WSGI cycle is complete and the transaction is finished
489495 client .post ("/graphql" , json = {"query" : query }).close ()
490496
491497 assert len (events ) == 1
@@ -566,6 +572,7 @@ def test_transaction_mutation(
566572 client = client_factory (schema )
567573
568574 query = 'mutation Change { change(attribute: "something") }'
575+ # Close the response to ensure the WSGI cycle is complete and the transaction is finished
569576 client .post ("/graphql" , json = {"query" : query }).close ()
570577
571578 assert len (events ) == 1
@@ -641,6 +648,7 @@ def test_handle_none_query_gracefully(
641648 client_factory = request .getfixturevalue (client_factory )
642649 client = client_factory (schema )
643650
651+ # Close the response to ensure the WSGI cycle is complete and the transaction is finished
644652 client .post ("/graphql" , json = {}).close ()
645653
646654 assert len (events ) == 0 , "expected no events to be sent to Sentry"
@@ -673,6 +681,7 @@ def test_span_origin(
673681 client = client_factory (schema )
674682
675683 query = 'mutation Change { change(attribute: "something") }'
684+ # Close the response to ensure the WSGI cycle is complete and the transaction is finished
676685 client .post ("/graphql" , json = {"query" : query }).close ()
677686
678687 (event ,) = events
@@ -715,6 +724,7 @@ def test_span_origin2(
715724 client = client_factory (schema )
716725
717726 query = "query GreetingQuery { hello }"
727+ # Close the response to ensure the WSGI cycle is complete and the transaction is finished
718728 client .post ("/graphql" , json = {"query" : query , "operationName" : "GreetingQuery" }).close ()
719729
720730 (event ,) = events
@@ -757,6 +767,7 @@ def test_span_origin3(
757767 client = client_factory (schema )
758768
759769 query = "subscription { messageAdded { content } }"
770+ # Close the response to ensure the WSGI cycle is complete and the transaction is finished
760771 client .post ("/graphql" , json = {"query" : query }).close ()
761772
762773 (event ,) = events
0 commit comments