22
22
pyiceberg_catalog = pytest .importorskip ("pyiceberg.catalog" )
23
23
pq = pytest .importorskip ("pyarrow.parquet" )
24
24
25
-
26
- Catalog = collections .namedtuple ("name" , "uri" )
25
+ Catalog = collections .namedtuple ("Catalog" , ["name" , "uri" ])
27
26
28
27
29
28
@pytest .fixture
30
- def catalog (request , tmp_path , params = ( None , "default" , "pandas_tests" ) ):
29
+ def catalog (request , tmp_path ):
31
30
# the catalog stores the full path of data files, so the catalog needs to be
32
31
# created dynamically, and not saved in pandas/tests/io/data as other formats
33
- catalog_path = tmp_path / "pandas-iceberg-catalog"
34
- catalog_path .mkdir ()
35
- catalog_name = request .param
36
- uri = f"sqlite:///{ catalog_path } /catalog.sqlite"
37
- warehouse = f"file://{ catalog_path } "
32
+ uri = f"sqlite:///{ tmp_path } /catalog.sqlite"
33
+ warehouse = f"file://{ tmp_path } "
34
+ catalog_name = request .param if hasattr (request , "param" ) else None
38
35
catalog = pyiceberg_catalog .load_catalog (
39
- catalog_name ,
36
+ catalog_name or "default" ,
40
37
type = "sql" ,
41
38
uri = uri ,
42
39
warehouse = warehouse ,
@@ -59,9 +56,9 @@ def catalog(request, tmp_path, params=(None, "default", "pandas_tests")):
59
56
uri: { uri }
60
57
warehouse: { warehouse } """ )
61
58
62
- importlib .reload (pyiceberg_catalog ) # needed to reload the config file
59
+ importlib .reload (pyiceberg_catalog ) # needed to reload the config file
63
60
64
- yield Catalog (name = catalog_name , uri = uri )
61
+ yield Catalog (name = catalog_name or "default" , uri = uri )
65
62
66
63
if catalog_name is not None :
67
64
config_path .unlink ()
@@ -81,6 +78,7 @@ def test_read(self, catalog):
81
78
)
82
79
tm .assert_frame_equal (result , expected )
83
80
81
+ @pytest .mark .parametrize ("catalog" , ["default" , "pandas_tests" ], indirect = True )
84
82
def test_read_by_catalog_name (self , catalog ):
85
83
expected = pd .DataFrame (
86
84
{
@@ -94,7 +92,7 @@ def test_read_by_catalog_name(self, catalog):
94
92
)
95
93
tm .assert_frame_equal (result , expected )
96
94
97
- def test_read_with_row_filter (self ):
95
+ def test_read_with_row_filter (self , catalog ):
98
96
expected = pd .DataFrame (
99
97
{
100
98
"A" : [2 , 3 ],
@@ -130,7 +128,7 @@ def test_read_with_case_sensitive(self, catalog):
130
128
case_sensitive = True ,
131
129
)
132
130
133
- def test_read_with_limit (self ):
131
+ def test_read_with_limit (self , catalog ):
134
132
expected = pd .DataFrame (
135
133
{
136
134
"A" : [1 , 2 ],
0 commit comments