Skip to content

Commit 2ef6343

Browse files
Fix tests after using fixture
1 parent 0a2e9ea commit 2ef6343

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

pandas/tests/io/test_iceberg.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,18 @@
2222
pyiceberg_catalog = pytest.importorskip("pyiceberg.catalog")
2323
pq = pytest.importorskip("pyarrow.parquet")
2424

25-
26-
Catalog = collections.namedtuple("name", "uri")
25+
Catalog = collections.namedtuple("Catalog", ["name", "uri"])
2726

2827

2928
@pytest.fixture
30-
def catalog(request, tmp_path, params=(None, "default", "pandas_tests")):
29+
def catalog(request, tmp_path):
3130
# the catalog stores the full path of data files, so the catalog needs to be
3231
# 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
3835
catalog = pyiceberg_catalog.load_catalog(
39-
catalog_name,
36+
catalog_name or "default",
4037
type="sql",
4138
uri=uri,
4239
warehouse=warehouse,
@@ -59,9 +56,9 @@ def catalog(request, tmp_path, params=(None, "default", "pandas_tests")):
5956
uri: {uri}
6057
warehouse: {warehouse}""")
6158

62-
importlib.reload(pyiceberg_catalog) # needed to reload the config file
59+
importlib.reload(pyiceberg_catalog) # needed to reload the config file
6360

64-
yield Catalog(name=catalog_name, uri=uri)
61+
yield Catalog(name=catalog_name or "default", uri=uri)
6562

6663
if catalog_name is not None:
6764
config_path.unlink()
@@ -81,6 +78,7 @@ def test_read(self, catalog):
8178
)
8279
tm.assert_frame_equal(result, expected)
8380

81+
@pytest.mark.parametrize("catalog", ["default", "pandas_tests"], indirect=True)
8482
def test_read_by_catalog_name(self, catalog):
8583
expected = pd.DataFrame(
8684
{
@@ -94,7 +92,7 @@ def test_read_by_catalog_name(self, catalog):
9492
)
9593
tm.assert_frame_equal(result, expected)
9694

97-
def test_read_with_row_filter(self):
95+
def test_read_with_row_filter(self, catalog):
9896
expected = pd.DataFrame(
9997
{
10098
"A": [2, 3],
@@ -130,7 +128,7 @@ def test_read_with_case_sensitive(self, catalog):
130128
case_sensitive=True,
131129
)
132130

133-
def test_read_with_limit(self):
131+
def test_read_with_limit(self, catalog):
134132
expected = pd.DataFrame(
135133
{
136134
"A": [1, 2],

0 commit comments

Comments
 (0)