From 5713f3b5d73a5a8133678adefe0189b858e4a64e Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Wed, 6 Nov 2024 18:27:36 -0800 Subject: [PATCH] fix test_get_gcs_logging_config_without_service_account --- tests/local_testing/test_gcs_bucket.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/local_testing/test_gcs_bucket.py b/tests/local_testing/test_gcs_bucket.py index 2b80d04df..f7cbff809 100644 --- a/tests/local_testing/test_gcs_bucket.py +++ b/tests/local_testing/test_gcs_bucket.py @@ -528,6 +528,8 @@ async def test_get_gcs_logging_config_without_service_account(): 1. Key based logging without a service account 2. Default Callback without a service account """ + _old_gcs_bucket_name = os.environ.get("GCS_BUCKET_NAME") + os.environ.pop("GCS_BUCKET_NAME") # Mock the load_auth function to avoid credential loading issues # Test 1: With standard_callback_dynamic_params (with service account) @@ -559,10 +561,8 @@ async def test_get_gcs_logging_config_without_service_account(): # Test 5: With missing bucket name with pytest.raises(ValueError, match="GCS_BUCKET_NAME is not set"): - _old_gcs_bucket_name = os.environ.get("GCS_BUCKET_NAME") - os.environ.pop("GCS_BUCKET_NAME") gcs_logger = GCSBucketLogger(bucket_name=None) await gcs_logger.get_gcs_logging_config({}) - if _old_gcs_bucket_name is not None: - os.environ["GCS_BUCKET_NAME"] = _old_gcs_bucket_name + if _old_gcs_bucket_name is not None: + os.environ["GCS_BUCKET_NAME"] = _old_gcs_bucket_name