File tree Expand file tree Collapse file tree
tests/model_registry/model_registry/python_client/signing Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -335,10 +335,12 @@ def downloaded_model_dir() -> Path:
335335
336336
337337@pytest .fixture (scope = "package" )
338- def set_environment_variables (securesign_instance : Securesign ) -> None :
338+ def set_environment_variables (securesign_instance : Securesign ) -> Generator [ None , Any ] :
339339 """
340340 Create a service account token and save it to a temporary directory.
341+ Automatically cleans up environment variables when fixture scope ends.
341342 """
343+ # Set up environment variables
342344 securesign_data = securesign_instance .instance .to_dict ()
343345 service_urls = get_tas_service_urls (securesign_instance = securesign_data )
344346 os .environ ["IDENTITY_TOKEN_PATH" ] = generate_token (temp_base_folder = py_config ["tmp_base_dir" ])
@@ -349,6 +351,23 @@ def set_environment_variables(securesign_instance: Securesign) -> None:
349351 os .environ ["ROOT_CHECKSUM" ] = get_root_checksum (sigstore_tuf_url = service_urls ["tuf" ])
350352 os .environ ["ROOT_URL" ] = os .environ ["SIGSTORE_TUF_URL" ] + "/root.json"
351353
354+ LOGGER .info ("Environment variables set for signing tests" )
355+ yield
356+
357+ # Clean up environment variables
358+ for var_name in [
359+ "IDENTITY_TOKEN_PATH" ,
360+ "SIGSTORE_TUF_URL" ,
361+ "SIGSTORE_FULCIO_URL" ,
362+ "SIGSTORE_REKOR_URL" ,
363+ "SIGSTORE_TSA_URL" ,
364+ "ROOT_CHECKSUM" ,
365+ "ROOT_URL" ,
366+ ]:
367+ os .environ .pop (var_name , None )
368+
369+ LOGGER .info ("Environment variables cleaned up" )
370+
352371
353372@pytest .fixture (scope = "function" )
354373def signer (set_environment_variables ) -> Signer :
You can’t perform that action at this time.
0 commit comments