Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

tests: add cleanup to iceberg tests (#4767)

Myles Scolnickca54e597fe54
diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml
index 9fedbb456e..1a831e9661 100644
--- a/.github/workflows/playwright.yml
+++ b/.github/workflows/playwright.yml
@@ -26,6 +26,7 @@ jobs:
- '!docs/**'
- '!examples/**'
- '!README.md'
+ - '!tests/**'
test:
needs: changes
diff --git a/.github/workflows/test_be.yaml b/.github/workflows/test_be.yaml
index b89071f000..2df9202d76 100644
--- a/.github/workflows/test_be.yaml
+++ b/.github/workflows/test_be.yaml
@@ -25,6 +25,7 @@ jobs:
- '!marimo/_smoke_tests/**'
- 'tests/**'
- 'pyproject.toml'
+ - '!frontend/**'
docs:
- 'docs/**'
diff --git a/.github/workflows/test_be_dagger.yaml.skip b/.github/workflows/test_be_dagger.yaml.skip
index 03072fc35a..5cd6f8f6d4 100644
--- a/.github/workflows/test_be_dagger.yaml.skip
+++ b/.github/workflows/test_be_dagger.yaml.skip
@@ -22,6 +22,7 @@ jobs:
- 'tests/**'
- 'pyproject.toml'
- 'dagger/**'
+ - '!frontend/**'
test_python:
needs: changes
diff --git a/marimo/_sql/engines/pyiceberg.py b/marimo/_sql/engines/pyiceberg.py
index 8f26919b3c..9c82ae3ede 100644
--- a/marimo/_sql/engines/pyiceberg.py
+++ b/marimo/_sql/engines/pyiceberg.py
@@ -87,7 +87,9 @@ class PyIcebergEngine(SQLEngine):
del include_schemas
databases: list[Database] = []
try:
- namespaces = self._catalog.list_namespaces()
+ namespaces = sorted(
+ self._catalog.list_namespaces()
+ ) # Sort for consistent ordering
for namespace in namespaces:
tables = []
if self._resolve_should_auto_discover(include_tables):
diff --git a/tests/_sql/test_pyiceberg.py b/tests/_sql/test_pyiceberg.py
index 5d0ffd2e20..da2865970b 100644
--- a/tests/_sql/test_pyiceberg.py
+++ b/tests/_sql/test_pyiceberg.py
@@ -16,14 +16,17 @@ from marimo._types.ids import VariableName
HAS_PYICEBERG = DependencyManager.pyiceberg.has()
if TYPE_CHECKING:
+ from collections.abc import Generator
+
from pyiceberg.catalog import Catalog
@pytest.fixture
-def memory_catalog() -> Catalog:
+def memory_catalog() -> Generator[Catalog, None, None]:
"""Create a mock PyIceberg catalog for testing."""
if not HAS_PYICEBERG:
- return mock.MagicMock()
+ yield mock.MagicMock()
+ return
from pyiceberg.catalog.memory import InMemoryCatalog
from pyiceberg.schema import Schema as IcebergSchema
@@ -66,7 +69,11 @@ def memory_catalog() -> Catalog:
assert len(catalog.list_tables("default")) == 2
assert len(catalog.list_tables("test_namespace")) == 1
- return catalog
+ yield catalog
+
+ catalog.drop_table(("default", "table1"))
+ catalog.drop_table(("default", "table2"))
+ catalog.drop_table(("test_namespace", "table3"))
def get_expected_table(