Skip to content

[SYNPY-1905] Fix problematic integration test - #1448

Open
andrewelamb wants to merge 3 commits into
developfrom
SYNPY-1905
Open

[SYNPY-1905] Fix problematic integration test#1448
andrewelamb wants to merge 3 commits into
developfrom
SYNPY-1905

Conversation

@andrewelamb

@andrewelamb andrewelamb commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Problem:

test_tables_pandas in tests/integration/synapseclient/deprecated/test_tables.py fails intermittently in CI with a DataFrame shape mismatch (SYNPY-1905):

AssertionError: DataFrame are different
DataFrame shape mismatch
[left]:  (20, 7)
[right]: (5, 7)

The queried table has 20 rows instead of the expected 5 — exactly 4x. Example failure: PR #1440 CI run.

Root cause: the test creates its schema with the fixed name "Nifty Table" inside the shared per-worker project, and syn.store uses create-or-update semantics. When the test fails once for a transient reason, pytest-rerunfailures (--reruns 3) re-runs it, and each attempt finds the existing table from the previous attempt and appends 5 more rows instead of creating a fresh table. The retries can never pass — 1 initial run + 3 reruns accumulate 4 × 5 = 20 rows, turning a one-off flake into a guaranteed failure.

Solution:

  • Give the schema a unique name per attempt ("Nifty Table " + str(uuid.uuid4())), matching the naming pattern already used by other tests in this file. Each rerun now creates a fresh, empty table, so a retry can actually succeed.
  • Schedule the stored table for cleanup via the schedule_for_cleanup fixture. The cleanup list is processed at session teardown regardless of test outcome, so uniquely named tables left by failed attempts are also deleted (previously the test relied solely on the project fixture teardown).

No production code is affected. Note this test lives in the deprecated test module that is slated for removal after the v5.0.0 release, so this is a minimal fix to stop the flakiness until then.

Testing:

  • pre-commit run --files tests/integration/synapseclient/deprecated/test_tables.py passes (ruff, black, isort, bandit).
  • The fix will be validated by the integration test run in CI on this PR; the failure mode only reproduces when pytest-rerunfailures retries the test after a transient failure.

@andrewelamb
andrewelamb requested a review from a team as a code owner August 19, 2026 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants