Skip to content

Commit 4101dd1

Browse files
committed
add fsspec test
1 parent 5751b80 commit 4101dd1

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

tests/catalog/test_sql.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
NoSuchTableError,
3737
TableAlreadyExistsError,
3838
)
39+
from pyiceberg.io import FSSPEC_FILE_IO, PY_IO_IMPL
3940
from pyiceberg.io.pyarrow import schema_to_pyarrow
4041
from pyiceberg.schema import Schema
4142
from pyiceberg.table.snapshots import Operation
@@ -83,7 +84,7 @@ def catalog_memory(warehouse: Path) -> Generator[SqlCatalog, None, None]:
8384
@pytest.fixture(scope="module")
8485
def catalog_sqlite(warehouse: Path) -> Generator[SqlCatalog, None, None]:
8586
props = {
86-
"uri": "sqlite:////tmp/sql-catalog.db",
87+
"uri": f"sqlite:////{warehouse}/sql-catalog.db",
8788
"warehouse": f"file://{warehouse}",
8889
}
8990
catalog = SqlCatalog("test_sql_catalog", **props)
@@ -95,7 +96,7 @@ def catalog_sqlite(warehouse: Path) -> Generator[SqlCatalog, None, None]:
9596
@pytest.fixture(scope="module")
9697
def catalog_sqlite_without_rowcount(warehouse: Path) -> Generator[SqlCatalog, None, None]:
9798
props = {
98-
"uri": "sqlite:////tmp/sql-catalog.db",
99+
"uri": f"sqlite:////{warehouse}/sql-catalog.db",
99100
"warehouse": f"file://{warehouse}",
100101
}
101102
catalog = SqlCatalog("test_sql_catalog", **props)
@@ -105,6 +106,20 @@ def catalog_sqlite_without_rowcount(warehouse: Path) -> Generator[SqlCatalog, No
105106
catalog.destroy_tables()
106107

107108

109+
@pytest.fixture(scope="module")
110+
def catalog_sqlite_fsspec(warehouse: Path) -> Generator[SqlCatalog, None, None]:
111+
props = {
112+
"uri": f"sqlite:////{warehouse}/sql-catalog.db",
113+
"warehouse": f"file://{warehouse}",
114+
PY_IO_IMPL: FSSPEC_FILE_IO,
115+
}
116+
catalog = SqlCatalog("test_sql_catalog", **props)
117+
catalog.create_tables()
118+
yield catalog
119+
catalog.destroy_tables()
120+
121+
122+
108123
def test_creation_with_no_uri() -> None:
109124
with pytest.raises(NoSuchPropertyException):
110125
SqlCatalog("test_ddb_catalog", not_uri="unused")
@@ -731,6 +746,7 @@ def test_commit_table(catalog: SqlCatalog, table_schema_nested: Schema, random_i
731746
lazy_fixture('catalog_memory'),
732747
lazy_fixture('catalog_sqlite'),
733748
lazy_fixture('catalog_sqlite_without_rowcount'),
749+
lazy_fixture('catalog_sqlite_fsspec'),
734750
],
735751
)
736752
def test_append_table(catalog: SqlCatalog, table_schema_simple: Schema, random_identifier: Identifier) -> None:

0 commit comments

Comments
 (0)