@@ -295,13 +295,13 @@ class TestS3AmbientCredentials:
295295
296296 def test_ambient_credentials_field_default (self ):
297297 """Test that ambient_credentials defaults to False"""
298- access_config = S3AccessConfig ()
299- assert access_config .ambient_credentials is False
298+ connection_config = S3ConnectionConfig ()
299+ assert connection_config .ambient_credentials is False
300300
301301 def test_ambient_credentials_field_explicit (self ):
302302 """Test setting ambient_credentials explicitly"""
303- access_config = S3AccessConfig (ambient_credentials = True )
304- assert access_config .ambient_credentials is True
303+ connection_config = S3ConnectionConfig (ambient_credentials = True )
304+ assert connection_config .ambient_credentials is True
305305
306306 def test_default_blocks_automatic_credentials (self ):
307307 """Test that default behavior blocks automatic credential pickup"""
@@ -341,8 +341,7 @@ def test_ambient_credentials_requires_env_var(self, monkeypatch):
341341 # Clear the environment variable
342342 monkeypatch .delenv ("ALLOW_AMBIENT_CREDENTIALS_S3" , raising = False )
343343
344- access_config = S3AccessConfig (ambient_credentials = True )
345- connection_config = S3ConnectionConfig (access_config = access_config , anonymous = False )
344+ connection_config = S3ConnectionConfig (ambient_credentials = True , anonymous = False )
346345
347346 # Should raise error when env var is not set
348347 with pytest .raises (
@@ -356,8 +355,7 @@ def test_ambient_credentials_enables_ambient_mode(self, monkeypatch):
356355 # Set the environment variable
357356 monkeypatch .setenv ("ALLOW_AMBIENT_CREDENTIALS_S3" , "true" )
358357
359- access_config = S3AccessConfig (ambient_credentials = True )
360- connection_config = S3ConnectionConfig (access_config = access_config , anonymous = False )
358+ connection_config = S3ConnectionConfig (ambient_credentials = True , anonymous = False )
361359
362360 config = connection_config .get_access_config ()
363361
@@ -373,9 +371,11 @@ def test_ambient_credentials_field_excluded_from_config(self):
373371 access_config = S3AccessConfig (
374372 key = "test-key" ,
375373 secret = "test-secret" ,
376- ambient_credentials = True , # Should be excluded
377374 )
378- connection_config = S3ConnectionConfig (access_config = access_config )
375+ connection_config = S3ConnectionConfig (
376+ access_config = access_config ,
377+ ambient_credentials = True , # Should be excluded from final config
378+ )
379379
380380 config = connection_config .get_access_config ()
381381
@@ -412,8 +412,7 @@ def test_endpoint_url_preserved_with_all_auth_modes(self, monkeypatch):
412412
413413 # Test with ambient credentials
414414 monkeypatch .setenv ("ALLOW_AMBIENT_CREDENTIALS_S3" , "true" )
415- access_config = S3AccessConfig (ambient_credentials = True )
416- connection_config = S3ConnectionConfig (access_config = access_config , endpoint_url = endpoint )
415+ connection_config = S3ConnectionConfig (ambient_credentials = True , endpoint_url = endpoint )
417416 config = connection_config .get_access_config ()
418417 assert config ["endpoint_url" ] == endpoint
419418
@@ -424,8 +423,7 @@ def test_endpoint_url_preserved_with_all_auth_modes(self, monkeypatch):
424423
425424 def test_authentication_error_raised (self ):
426425 """Test that authentication error is raised when automatic credentials would be used"""
427- access_config = S3AccessConfig (ambient_credentials = False )
428- connection_config = S3ConnectionConfig (access_config = access_config , anonymous = False )
426+ connection_config = S3ConnectionConfig (ambient_credentials = False , anonymous = False )
429427
430428 # This should raise UserAuthError with helpful message
431429 with pytest .raises (UserAuthError ) as exc_info :
@@ -440,8 +438,7 @@ def test_ambient_credentials_env_var_variations(self, monkeypatch):
440438 """Test that only 'true' (case-insensitive) values for ALLOW_AMBIENT_CREDENTIALS_S3 work"""
441439 valid_values = ["true" , "TRUE" , "True" , "tRuE" ]
442440
443- access_config = S3AccessConfig (ambient_credentials = True )
444- connection_config = S3ConnectionConfig (access_config = access_config , anonymous = False )
441+ connection_config = S3ConnectionConfig (ambient_credentials = True , anonymous = False )
445442
446443 for value in valid_values :
447444 monkeypatch .setenv ("ALLOW_AMBIENT_CREDENTIALS_S3" , value )
@@ -460,8 +457,7 @@ def test_ambient_credentials_info_logged(self, caplog, monkeypatch):
460457 # Ensure we capture INFO level logs
461458 caplog .set_level (logging .INFO )
462459
463- access_config = S3AccessConfig (ambient_credentials = True )
464- connection_config = S3ConnectionConfig (access_config = access_config , anonymous = False )
460+ connection_config = S3ConnectionConfig (ambient_credentials = True , anonymous = False )
465461
466462 # This should trigger the ambient credentials info log
467463 config = connection_config .get_access_config ()
@@ -491,7 +487,7 @@ async def test_s3_destination_with_ambient_credentials(self, upload_file: Path,
491487
492488 # Use ambient credentials (no explicit key/secret provided)
493489 connection_config = S3ConnectionConfig (
494- access_config = S3AccessConfig ( ambient_credentials = True ) ,
490+ ambient_credentials = True ,
495491 )
496492 upload_config = S3UploaderConfig (remote_url = destination_path )
497493 uploader = S3Uploader (connection_config = connection_config , upload_config = upload_config )
0 commit comments