5656 GCS_SERVICE_HOST ,
5757 GCS_TOKEN ,
5858 GCS_TOKEN_EXPIRES_AT_MS ,
59+ ADLS_ACCOUNT_NAME ,
60+ ADLS_ACCOUNT_KEY ,
61+ ADLS_BLOB_STORAGE_AUTHORITY ,
62+ ADLS_DFS_STORAGE_SCHEME ,
63+ ADLS_BLOB_STORAGE_SCHEME ,
64+ ADLS_DFS_STORAGE_AUTHORITY ,
5965 fsspec ,
6066 load_file_io ,
6167)
@@ -348,6 +354,11 @@ def table_schema_with_all_types() -> Schema:
348354 )
349355
350356
357+ @pytest .fixture (params = ["abfss" , "wasbs" ])
358+ def adls_scheme (request ):
359+ return request .param
360+
361+
351362@pytest .fixture (scope = "session" )
352363def pyarrow_schema_simple_without_ids () -> "pa.Schema" :
353364 import pyarrow as pa
@@ -2089,7 +2100,27 @@ def fsspec_fileio_gcs(request: pytest.FixtureRequest) -> FsspecFileIO:
20892100
20902101
20912102@pytest .fixture
2092- def pyarrow_fileio_gcs (request : pytest .FixtureRequest ) -> "PyArrowFileIO" :
2103+ def adls_fsspec_fileio (request : pytest .FixtureRequest ) -> Generator [FsspecFileIO , None , None ]:
2104+ from azure .storage .blob import BlobServiceClient
2105+
2106+ azurite_url = request .config .getoption ("--adls.endpoint" )
2107+ azurite_account_name = request .config .getoption ("--adls.account-name" )
2108+ azurite_account_key = request .config .getoption ("--adls.account-key" )
2109+ azurite_connection_string = f"DefaultEndpointsProtocol=http;AccountName={ azurite_account_name } ;AccountKey={ azurite_account_key } ;BlobEndpoint={ azurite_url } /{ azurite_account_name } ;"
2110+ properties = {
2111+ "adls.connection-string" : azurite_connection_string ,
2112+ "adls.account-name" : azurite_account_name ,
2113+ }
2114+
2115+ bbs = BlobServiceClient .from_connection_string (conn_str = azurite_connection_string )
2116+ bbs .create_container ("tests" )
2117+ yield fsspec .FsspecFileIO (properties = properties )
2118+ bbs .delete_container ("tests" )
2119+ bbs .close ()
2120+
2121+
2122+ @pytest .fixture
2123+ def pyarrow_fileio_gcs (request : pytest .FixtureRequest ) -> 'PyArrowFileIO' :
20932124 from pyiceberg .io .pyarrow import PyArrowFileIO
20942125
20952126 properties = {
@@ -2101,6 +2132,33 @@ def pyarrow_fileio_gcs(request: pytest.FixtureRequest) -> "PyArrowFileIO":
21012132 return PyArrowFileIO (properties = properties )
21022133
21032134
2135+ @pytest .fixture
2136+ def pyarrow_fileio_adls (request : pytest .FixtureRequest ) -> Generator [Any , None , None ]:
2137+ from azure .storage .blob import BlobServiceClient
2138+ from pyiceberg .io .pyarrow import PyArrowFileIO
2139+
2140+ azurite_url = request .config .getoption ("--adls.endpoint" )
2141+ azurite_scheme , azurite_authority = azurite_url .split ('://' , 1 )
2142+
2143+ azurite_account_name = request .config .getoption ("--adls.account-name" )
2144+ azurite_account_key = request .config .getoption ("--adls.account-key" )
2145+ azurite_connection_string = f"DefaultEndpointsProtocol=http;AccountName={ azurite_account_name } ;AccountKey={ azurite_account_key } ;BlobEndpoint={ azurite_url } /{ azurite_account_name } ;"
2146+ properties = {
2147+ ADLS_ACCOUNT_NAME : azurite_account_name ,
2148+ ADLS_ACCOUNT_KEY : azurite_account_key ,
2149+ ADLS_BLOB_STORAGE_AUTHORITY : azurite_authority ,
2150+ ADLS_DFS_STORAGE_AUTHORITY : azurite_authority ,
2151+ ADLS_BLOB_STORAGE_SCHEME : azurite_scheme ,
2152+ ADLS_DFS_STORAGE_SCHEME : azurite_scheme ,
2153+ }
2154+
2155+ bbs = BlobServiceClient .from_connection_string (conn_str = azurite_connection_string )
2156+ bbs .create_container ("warehouse" )
2157+ yield PyArrowFileIO (properties = properties )
2158+ bbs .delete_container ("warehouse" )
2159+ bbs .close ()
2160+
2161+
21042162def aws_credentials () -> None :
21052163 os .environ ["AWS_ACCESS_KEY_ID" ] = "testing"
21062164 os .environ ["AWS_SECRET_ACCESS_KEY" ] = "testing"
@@ -2162,26 +2220,6 @@ def fixture_dynamodb(_aws_credentials: None) -> Generator[boto3.client, None, No
21622220 yield boto3 .client ("dynamodb" , region_name = "us-east-1" )
21632221
21642222
2165- @pytest .fixture
2166- def adls_fsspec_fileio (request : pytest .FixtureRequest ) -> Generator [FsspecFileIO , None , None ]:
2167- from azure .storage .blob import BlobServiceClient
2168-
2169- azurite_url = request .config .getoption ("--adls.endpoint" )
2170- azurite_account_name = request .config .getoption ("--adls.account-name" )
2171- azurite_account_key = request .config .getoption ("--adls.account-key" )
2172- azurite_connection_string = f"DefaultEndpointsProtocol=http;AccountName={ azurite_account_name } ;AccountKey={ azurite_account_key } ;BlobEndpoint={ azurite_url } /{ azurite_account_name } ;"
2173- properties = {
2174- "adls.connection-string" : azurite_connection_string ,
2175- "adls.account-name" : azurite_account_name ,
2176- }
2177-
2178- bbs = BlobServiceClient .from_connection_string (conn_str = azurite_connection_string )
2179- bbs .create_container ("tests" )
2180- yield fsspec .FsspecFileIO (properties = properties )
2181- bbs .delete_container ("tests" )
2182- bbs .close ()
2183-
2184-
21852223@pytest .fixture (scope = "session" )
21862224def empty_home_dir_path (tmp_path_factory : pytest .TempPathFactory ) -> str :
21872225 home_path = str (tmp_path_factory .mktemp ("home" ))
0 commit comments