Skip to content

Commit 329b1bd

Browse files
committed
fix: resolve ruff import ordering and pagination cleanup bug
Merge the duplicate typedef import in test_rest.py that ruff's import sorter flagged. Also fix clean_up() in conftest, which iterated and mutated (drop_table/drop_namespace) over list_* results in the same pass - now that those can be lazily-paginated, deleting an item before the next page is fetched shifts the server-side offset and skips entries. Materialize with list() first.
1 parent 7ab945a commit 329b1bd

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

tests/catalog/test_rest.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,9 @@
6565
from pyiceberg.table.metadata import TableMetadataV1
6666
from pyiceberg.table.sorting import SortField, SortOrder
6767
from pyiceberg.transforms import IdentityTransform, TruncateTransform
68-
from pyiceberg.typedef import RecursiveDict
68+
from pyiceberg.typedef import PaginationList, RecursiveDict
6969
from pyiceberg.types import StringType
7070
from pyiceberg.utils.config import Config
71-
from pyiceberg.typedef import PaginationList
7271
from pyiceberg.view import View
7372
from pyiceberg.view.metadata import ViewMetadata, ViewVersion
7473

tests/conftest.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2505,13 +2505,15 @@ def fixture_s3_client() -> boto3.client:
25052505

25062506
def clean_up(test_catalog: Catalog) -> None:
25072507
"""Clean all databases and tables created during the integration test."""
2508-
for database_tuple in test_catalog.list_namespaces():
2508+
# Materialize before mutating: list_* may return a lazily-paginated list, and
2509+
# dropping entries while paging would shift the underlying page offsets.
2510+
for database_tuple in list(test_catalog.list_namespaces()):
25092511
database_name = database_tuple[0]
25102512
if "my_iceberg_database-" in database_name:
2511-
for identifier in test_catalog.list_tables(database_name):
2513+
for identifier in list(test_catalog.list_tables(database_name)):
25122514
test_catalog.drop_table(identifier)
25132515
try:
2514-
for identifier in test_catalog.list_views(database_name):
2516+
for identifier in list(test_catalog.list_views(database_name)):
25152517
test_catalog.drop_view(identifier)
25162518
except NotImplementedError:
25172519
pass

0 commit comments

Comments
 (0)