@@ -369,7 +369,8 @@ def test_operations_client_client_options(
369369 )
370370
371371 # Check the case credentials_file is provided
372- options = client_options .ClientOptions (credentials_file = "credentials.json" )
372+ with pytest .warns (DeprecationWarning ):
373+ options = client_options .ClientOptions (credentials_file = "credentials.json" )
373374 with mock .patch .object (transport_class , "__init__" ) as patched :
374375 patched .return_value = None
375376 client = client_class (client_options = options , transport = transport_name )
@@ -539,7 +540,8 @@ def test_operations_client_client_options_credentials_file(
539540 client_class , transport_class , transport_name
540541):
541542 # Check the case credentials file is provided.
542- options = client_options .ClientOptions (credentials_file = "credentials.json" )
543+ with pytest .warns (DeprecationWarning ):
544+ options = client_options .ClientOptions (credentials_file = "credentials.json" )
543545 if "async" in str (client_class ):
544546 # TODO(): Add support for credentials file to async REST transport.
545547 with pytest .raises (core_exceptions .AsyncRestUnsupportedParameterError ):
@@ -570,10 +572,17 @@ def test_operations_client_client_options_credentials_file(
570572 return_value = (mock .sentinel .credentials , mock .sentinel .project ),
571573)
572574def test_list_operations_rest (google_auth_default , credentials_file ):
573- sync_transport = transports .rest .OperationsRestTransport (
574- credentials_file = credentials_file ,
575- http_options = HTTP_OPTIONS ,
576- )
575+ if credentials_file is not None :
576+ with pytest .warns (DeprecationWarning ):
577+ sync_transport = transports .rest .OperationsRestTransport (
578+ credentials_file = credentials_file ,
579+ http_options = HTTP_OPTIONS ,
580+ )
581+ else :
582+ sync_transport = transports .rest .OperationsRestTransport (
583+ credentials_file = credentials_file ,
584+ http_options = HTTP_OPTIONS ,
585+ )
577586
578587 client = AbstractOperationsClient (transport = sync_transport )
579588
@@ -1130,10 +1139,11 @@ def test_transport_adc(client_class, transport_class, credentials):
11301139def test_operations_base_transport_error ():
11311140 # Passing both a credentials object and credentials_file should raise an error
11321141 with pytest .raises (core_exceptions .DuplicateCredentialArgs ):
1133- transports .OperationsTransport (
1134- credentials = ga_credentials .AnonymousCredentials (),
1135- credentials_file = "credentials.json" ,
1136- )
1142+ with pytest .warns (DeprecationWarning ):
1143+ transports .OperationsTransport (
1144+ credentials = ga_credentials .AnonymousCredentials (),
1145+ credentials_file = "credentials.json" ,
1146+ )
11371147
11381148
11391149def test_operations_base_transport ():
@@ -1171,10 +1181,11 @@ def test_operations_base_transport_with_credentials_file():
11711181 ) as Transport :
11721182 Transport .return_value = None
11731183 load_creds .return_value = (ga_credentials .AnonymousCredentials (), None )
1174- transports .OperationsTransport (
1175- credentials_file = "credentials.json" ,
1176- quota_project_id = "octopus" ,
1177- )
1184+ with pytest .warns (DeprecationWarning ):
1185+ transports .OperationsTransport (
1186+ credentials_file = "credentials.json" ,
1187+ quota_project_id = "octopus" ,
1188+ )
11781189 load_creds .assert_called_once_with (
11791190 "credentials.json" ,
11801191 scopes = None ,
0 commit comments