@@ -406,12 +406,10 @@ def test_objects_compose(self, mock_requests: Mock) -> None:
406406 )
407407
408408 with self .tracer .start_as_current_span ("test" ):
409- client .bucket ("test bucket" ).blob ("dest object" ).compose (
410- [
411- storage .blob .Blob ("object 1" , "test bucket" ),
412- storage .blob .Blob ("object 2" , "test bucket" ),
413- ]
414- )
409+ client .bucket ("test bucket" ).blob ("dest object" ).compose ([
410+ storage .blob .Blob ("object 1" , "test bucket" ),
411+ storage .blob .Blob ("object 2" , "test bucket" ),
412+ ])
415413
416414 spans = self .recorder .queued_spans ()
417415
@@ -1046,10 +1044,9 @@ def test_batch_operation(self, mock_requests: Mock) -> None:
10461044 )
10471045 bucket = client .bucket ("test-bucket" )
10481046
1049- with self .tracer .start_as_current_span ("test" ):
1050- with client .batch ():
1051- for obj in ["obj1" , "obj2" ]:
1052- bucket .delete_blob (obj )
1047+ with self .tracer .start_as_current_span ("test" ), client .batch ():
1048+ for obj in ["obj1" , "obj2" ]:
1049+ bucket .delete_blob (obj )
10531050
10541051 spans = self .recorder .queued_spans ()
10551052
@@ -1064,9 +1061,12 @@ def test_execute_with_instana_without_tags(self, mock_requests: Mock) -> None:
10641061 client = self ._client (
10651062 credentials = AnonymousCredentials (), project = "test-project"
10661063 )
1067- with self .tracer .start_as_current_span ("test" ), patch (
1068- "instana.instrumentation.google.cloud.storage._collect_attributes" ,
1069- return_value = None ,
1064+ with (
1065+ self .tracer .start_as_current_span ("test" ),
1066+ patch (
1067+ "instana.instrumentation.google.cloud.storage._collect_attributes" ,
1068+ return_value = None ,
1069+ ),
10701070 ):
10711071 buckets = client .list_buckets ()
10721072 for b in buckets :
@@ -1077,9 +1077,12 @@ def test_execute_with_instana_is_tracing_off(self) -> None:
10771077 client = self ._client (
10781078 credentials = AnonymousCredentials (), project = "test-project"
10791079 )
1080- with self .tracer .start_as_current_span ("test" ), patch (
1081- "instana.instrumentation.google.cloud.storage.get_tracer_tuple" ,
1082- return_value = (None , None , None ),
1080+ with (
1081+ self .tracer .start_as_current_span ("test" ),
1082+ patch (
1083+ "instana.instrumentation.google.cloud.storage.get_tracer_tuple" ,
1084+ return_value = (None , None , None ),
1085+ ),
10831086 ):
10841087 response = client .list_buckets ()
10851088 assert isinstance (response .client , storage .Client )
@@ -1096,12 +1099,16 @@ def test_download_with_instana_is_tracing_off(self, mock_requests: Mock) -> None
10961099 client = self ._client (
10971100 credentials = AnonymousCredentials (), project = "test-project"
10981101 )
1099- with self .tracer .start_as_current_span ("test" ), patch (
1100- "instana.instrumentation.google.cloud.storage.get_tracer_tuple" ,
1101- return_value = (None , None , None ),
1102+ with (
1103+ self .tracer .start_as_current_span ("test" ),
1104+ patch (
1105+ "instana.instrumentation.google.cloud.storage.get_tracer_tuple" ,
1106+ return_value = (None , None , None ),
1107+ ),
11021108 ):
11031109 response = (
1104- client .bucket ("test bucket" )
1110+ client
1111+ .bucket ("test bucket" )
11051112 .blob ("test object" )
11061113 .download_to_file (
11071114 io .BytesIO (),
@@ -1120,12 +1127,16 @@ def test_upload_with_instana_is_tracing_off(self, mock_requests: Mock) -> None:
11201127 credentials = AnonymousCredentials (), project = "test-project"
11211128 )
11221129
1123- with self .tracer .start_as_current_span ("test" ), patch (
1124- "instana.instrumentation.google.cloud.storage.get_tracer_tuple" ,
1125- return_value = (None , None , None ),
1130+ with (
1131+ self .tracer .start_as_current_span ("test" ),
1132+ patch (
1133+ "instana.instrumentation.google.cloud.storage.get_tracer_tuple" ,
1134+ return_value = (None , None , None ),
1135+ ),
11261136 ):
11271137 response = (
1128- client .bucket ("test bucket" )
1138+ client
1139+ .bucket ("test bucket" )
11291140 .blob ("test object" )
11301141 .upload_from_string ("CONTENT" )
11311142 )
@@ -1144,14 +1155,17 @@ def test_finish_batch_operation_is_tracing_off(self, mock_requests: Mock) -> Non
11441155 )
11451156 bucket = client .bucket ("test-bucket" )
11461157
1147- with self .tracer .start_as_current_span ("test" ), patch (
1148- "instana.instrumentation.google.cloud.storage.get_tracer_tuple" ,
1149- return_value = (None , None , None ),
1158+ with (
1159+ self .tracer .start_as_current_span ("test" ),
1160+ patch (
1161+ "instana.instrumentation.google.cloud.storage.get_tracer_tuple" ,
1162+ return_value = (None , None , None ),
1163+ ),
1164+ client .batch () as batch_response ,
11501165 ):
1151- with client .batch () as batch_response :
1152- for obj in ["obj1" , "obj2" ]:
1153- bucket .delete_blob (obj )
1154- assert batch_response
1166+ for obj in ["obj1" , "obj2" ]:
1167+ bucket .delete_blob (obj )
1168+ assert batch_response
11551169
11561170 def _client (self , * args , ** kwargs ) -> storage .Client :
11571171 # override the HTTP client to bypass the authorization
0 commit comments