2424output is the purview of the other tests in this directory."""
2525
2626import asyncio
27+ import gzip
2728import json
2829import os
2930import subprocess
3031
31- import gzip
3232import google .auth
3333import google .auth .credentials
3434import google .genai
@@ -58,7 +58,10 @@ def _get_project_from_env():
5858def _get_project_from_gcloud_cli ():
5959 try :
6060 gcloud_call_result = subprocess .run (
61- "gcloud config get project" , shell = True , capture_output = True , check = True
61+ "gcloud config get project" ,
62+ shell = True ,
63+ capture_output = True ,
64+ check = True ,
6265 )
6366 except subprocess .CalledProcessError :
6467 return None
@@ -193,7 +196,9 @@ def _literal_block_scalar_presenter(dumper, data):
193196 return dumper .represent_scalar ("tag:yaml.org,2002:str" , data , style = "|" )
194197
195198
196- @pytest .fixture (name = "internal_setup_yaml_pretty_formatting" , scope = "module" , autouse = True )
199+ @pytest .fixture (
200+ name = "internal_setup_yaml_pretty_formatting" , scope = "module" , autouse = True
201+ )
197202def fixture_setup_yaml_pretty_formatting ():
198203 yaml .add_representer (_LiteralBlockScalar , _literal_block_scalar_presenter )
199204
@@ -251,13 +256,24 @@ def _ensure_casette_gzip(loaded_casette):
251256 for interaction in loaded_casette ["interactions" ]:
252257 response = interaction ["response" ]
253258 headers = response ["headers" ]
254- if "content-encoding" not in headers and "Content-Encoding" not in headers :
259+ if (
260+ "content-encoding" not in headers
261+ and "Content-Encoding" not in headers
262+ ):
255263 continue
256- if "content-encoding" in headers and "gzip" not in headers ["content-encoding" ]:
264+ if (
265+ "content-encoding" in headers
266+ and "gzip" not in headers ["content-encoding" ]
267+ ):
257268 continue
258- if "Content-Encoding" in headers and "gzip" not in headers ["Content-Encoding" ]:
269+ if (
270+ "Content-Encoding" in headers
271+ and "gzip" not in headers ["Content-Encoding" ]
272+ ):
259273 continue
260- response ["body" ]["string" ] = _ensure_gzip_single_response (response ["body" ]["string" ].encode ())
274+ response ["body" ]["string" ] = _ensure_gzip_single_response (
275+ response ["body" ]["string" ].encode ()
276+ )
261277
262278
263279class _PrettyPrintJSONBody :
@@ -304,7 +320,11 @@ def fixture_otel_mocker():
304320 result .uninstall ()
305321
306322
307- @pytest .fixture (name = "setup_content_recording" , autouse = True , params = ["logcontent" , "excludecontent" ])
323+ @pytest .fixture (
324+ name = "setup_content_recording" ,
325+ autouse = True ,
326+ params = ["logcontent" , "excludecontent" ],
327+ )
308328def fixture_setup_content_recording (request ):
309329 enabled = request .param == "logcontent"
310330 os .environ ["OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT" ] = str (
@@ -372,7 +392,9 @@ def _factory():
372392
373393
374394@pytest .fixture (name = "vertex_client_factory" )
375- def fixture_vertex_client_factory (gcloud_project , gcloud_location , gcloud_credentials ):
395+ def fixture_vertex_client_factory (
396+ gcloud_project , gcloud_location , gcloud_credentials
397+ ):
376398 def _factory ():
377399 return google .genai .Client (
378400 vertexai = True ,
@@ -397,7 +419,9 @@ def fixture_use_vertex(genai_sdk_backend):
397419
398420
399421@pytest .fixture (name = "client" )
400- def fixture_client (vertex_client_factory , nonvertex_client_factory , use_vertex ):
422+ def fixture_client (
423+ vertex_client_factory , nonvertex_client_factory , use_vertex
424+ ):
401425 if use_vertex :
402426 return vertex_client_factory ()
403427 return nonvertex_client_factory ()
0 commit comments