Skip to content

Commit 4ea23bb

Browse files
author
Paul Mathew
committed
fix(tests): isolate state in test_write_optional_list
`test_write_optional_list` uses `create_table_if_not_exists` and then asserts exact row counts after two `tbl.append()` calls. On any subsequent run the table is reused, so the asserted counts (2, then 4) become 6, 10, ... and the test fails. The failure only surfaces when the integration suite is replayed without a fresh docker-compose stack, which masks the bug in CI but makes it a papercut for local development. Drop the table at the start to guarantee a clean slate, matching the pattern used by `_create_table()` for every other write test in this module.
1 parent d008a04 commit 4ea23bb

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎tests/integration/test_writes/test_writes.py‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2027,7 +2027,15 @@ def test_write_optional_list(session_catalog: Catalog) -> None:
20272027
required=False,
20282028
),
20292029
)
2030-
session_catalog.create_table_if_not_exists(identifier, schema)
2030+
# Ensure a clean slate: the test asserts exact row counts after each
2031+
# append, so a stale table from a previous run would accumulate rows and
2032+
# fail. Other tests in this module use _create_table() which does the same
2033+
# drop-if-exists step.
2034+
try:
2035+
session_catalog.drop_table(identifier=identifier)
2036+
except NoSuchTableError:
2037+
pass
2038+
session_catalog.create_table(identifier, schema)
20312039

20322040
df_1 = pa.Table.from_pylist(
20332041
[

0 commit comments

Comments
 (0)