@@ -306,6 +306,36 @@ def test_fsspec_s3_session_properties() -> None:
306306 )
307307
308308
309+ def test_fsspec_s3_session_properties_with_addressing_style () -> None :
310+ session_properties : Properties = {
311+ "s3.addressing-style" : "virtual" ,
312+ "s3.endpoint" : "http://localhost:9000" ,
313+ "s3.access-key-id" : "admin" ,
314+ "s3.secret-access-key" : "password" ,
315+ "s3.region" : "us-east-1" ,
316+ "s3.session-token" : "s3.session-token" ,
317+ ** UNIFIED_AWS_SESSION_PROPERTIES ,
318+ }
319+
320+ with mock .patch ("s3fs.S3FileSystem" ) as mock_s3fs :
321+ s3_fileio = FsspecFileIO (properties = session_properties )
322+ filename = str (uuid .uuid4 ())
323+
324+ s3_fileio .new_input (location = f"s3://warehouse/{ filename } " )
325+
326+ mock_s3fs .assert_called_with (
327+ anon = False ,
328+ client_kwargs = {
329+ "endpoint_url" : "http://localhost:9000" ,
330+ "aws_access_key_id" : "admin" ,
331+ "aws_secret_access_key" : "password" ,
332+ "region_name" : "us-east-1" ,
333+ "aws_session_token" : "s3.session-token" ,
334+ },
335+ config_kwargs = {"s3" : {"addressing_style" : "virtual" }},
336+ )
337+
338+
309339def test_fsspec_s3_session_properties_with_anonymous () -> None :
310340 session_properties : Properties = {
311341 "s3.anonymous" : "true" ,
0 commit comments