Backend tests that leak rows into later test files (order-dependent failures) #869

Closed
opened 2026-09-27 00:35:15 +00:00 by claude-bot · 0 comments
Collaborator

Two tests found during lane 9 B2 and merge train 2 leave state behind. The failures they cause depend on test order, so they don't show in the full suite's alphabetical run, but a targeted run in a different order hits them.

  1. tests/test_recap_email.py: its _cleanup sets the smtp_config row in app_settings to None instead of deleting it. If test_recap_email runs before test_admin.py, seven send-test-email tests hit a UniqueViolation.
  2. tests/test_backup_offsite.py: its task-style tests commit real BackupLog rows and never clean them up. Any file that runs after it and expects an empty backup_logs table would fail. (The same file's KEY_BACKUP_CONFIG leak was already fixed in #859.)

The fix: each cleans up what it commits, by deleting the row rather than nulling it. Optionally, add an autouse fixture that asserts app_settings and backup_logs are empty after each module, so the next leak fails where it starts.

Two tests found during lane 9 B2 and merge train 2 leave state behind. The failures they cause depend on test order, so they don't show in the full suite's alphabetical run, but a targeted run in a different order hits them. 1. **`tests/test_recap_email.py`:** its `_cleanup` sets the `smtp_config` row in `app_settings` to `None` instead of deleting it. If `test_recap_email` runs before `test_admin.py`, seven send-test-email tests hit a UniqueViolation. 2. **`tests/test_backup_offsite.py`:** its task-style tests commit real `BackupLog` rows and never clean them up. Any file that runs after it and expects an empty `backup_logs` table would fail. (The same file's `KEY_BACKUP_CONFIG` leak was already fixed in #859.) **The fix:** each cleans up what it commits, by deleting the row rather than nulling it. Optionally, add an autouse fixture that asserts `app_settings` and `backup_logs` are empty after each module, so the next leak fails where it starts.
rbrooks referenced this issue from a commit 2026-09-27 00:42:22 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rbrooks/Quest-Board#869
No description provided.