@@ -427,8 +427,10 @@ def test_retrieve_subject_token_expired_token(self):
427427 assert excinfo .match (r"The token returned by the executable is expired." )
428428
429429 @mock .patch .dict (os .environ , {"GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES" : "1" })
430- def test_retrieve_subject_token_file_cache (self ):
431- ACTUAL_CREDENTIAL_SOURCE_EXECUTABLE_OUTPUT_FILE = "actual_output_file"
430+ def test_retrieve_subject_token_file_cache (self , tmpdir ):
431+ ACTUAL_CREDENTIAL_SOURCE_EXECUTABLE_OUTPUT_FILE = tmpdir .join (
432+ "actual_output_file"
433+ )
432434 ACTUAL_CREDENTIAL_SOURCE_EXECUTABLE = {
433435 "command" : "command" ,
434436 "timeout_millis" : 30000 ,
@@ -472,8 +474,10 @@ def test_retrieve_subject_token_no_file_cache(self):
472474 assert subject_token == self .EXECUTABLE_OIDC_TOKEN
473475
474476 @mock .patch .dict (os .environ , {"GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES" : "1" })
475- def test_retrieve_subject_token_file_cache_value_error_report (self ):
476- ACTUAL_CREDENTIAL_SOURCE_EXECUTABLE_OUTPUT_FILE = "actual_output_file"
477+ def test_retrieve_subject_token_file_cache_value_error_report (self , tmpdir ):
478+ ACTUAL_CREDENTIAL_SOURCE_EXECUTABLE_OUTPUT_FILE = tmpdir .join (
479+ "actual_output_file"
480+ )
477481 ACTUAL_CREDENTIAL_SOURCE_EXECUTABLE = {
478482 "command" : "command" ,
479483 "timeout_millis" : 30000 ,
@@ -499,8 +503,10 @@ def test_retrieve_subject_token_file_cache_value_error_report(self):
499503 os .remove (ACTUAL_CREDENTIAL_SOURCE_EXECUTABLE_OUTPUT_FILE )
500504
501505 @mock .patch .dict (os .environ , {"GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES" : "1" })
502- def test_retrieve_subject_token_file_cache_refresh_error_retry (self ):
503- ACTUAL_CREDENTIAL_SOURCE_EXECUTABLE_OUTPUT_FILE = "actual_output_file"
506+ def test_retrieve_subject_token_file_cache_refresh_error_retry (self , tmpdir ):
507+ ACTUAL_CREDENTIAL_SOURCE_EXECUTABLE_OUTPUT_FILE = tmpdir .join (
508+ "actual_output_file"
509+ )
504510 ACTUAL_CREDENTIAL_SOURCE_EXECUTABLE = {
505511 "command" : "command" ,
506512 "timeout_millis" : 30000 ,
@@ -637,7 +643,7 @@ def test_retrieve_subject_token_missing_error_code_message(self):
637643
638644 @mock .patch .dict (os .environ , {"GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES" : "1" })
639645 def test_retrieve_subject_token_without_expiration_time_should_fail_when_output_file_specified (
640- self
646+ self ,
641647 ):
642648 EXECUTABLE_SUCCESSFUL_OIDC_RESPONSE = {
643649 "version" : 1 ,
@@ -665,9 +671,11 @@ def test_retrieve_subject_token_without_expiration_time_should_fail_when_output_
665671
666672 @mock .patch .dict (os .environ , {"GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES" : "1" })
667673 def test_retrieve_subject_token_without_expiration_time_should_fail_when_retrieving_from_output_file (
668- self
674+ self , tmpdir
669675 ):
670- ACTUAL_CREDENTIAL_SOURCE_EXECUTABLE_OUTPUT_FILE = "actual_output_file"
676+ ACTUAL_CREDENTIAL_SOURCE_EXECUTABLE_OUTPUT_FILE = tmpdir .join (
677+ "actual_output_file"
678+ )
671679 ACTUAL_CREDENTIAL_SOURCE_EXECUTABLE = {
672680 "command" : "command" ,
673681 "timeout_millis" : 30000 ,
@@ -692,7 +700,7 @@ def test_retrieve_subject_token_without_expiration_time_should_fail_when_retriev
692700
693701 @mock .patch .dict (os .environ , {"GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES" : "1" })
694702 def test_retrieve_subject_token_without_expiration_time_should_pass_when_output_file_not_specified (
695- self
703+ self ,
696704 ):
697705 EXECUTABLE_SUCCESSFUL_OIDC_RESPONSE = {
698706 "version" : 1 ,
0 commit comments