Skip to content

Fix test isolation in Flask app database tests#2971

Merged
adamtheturtle merged 2 commits intomainfrom
adamtheturtle/fix-leaky-tests
Feb 21, 2026
Merged

Fix test isolation in Flask app database tests#2971
adamtheturtle merged 2 commits intomainfrom
adamtheturtle/fix-leaky-tests

Conversation

@adamtheturtle
Copy link
Member

@adamtheturtle adamtheturtle commented Feb 21, 2026

Summary

Reset TARGET_MANAGER state between tests by cleaning up cloud and VuMark databases in the autouse fixture. This fixes the leaky test issue where the module-level singleton was persisting state across tests, which required workaround keys ("v1", "v2", "v3" instead of "1", "2", "3") in test_duplicate_vumark_keys.

The fix reuses the public API (remove_cloud_database/remove_vumark_database) to clean up after each test, ensuring proper test isolation.

Changes

  • Import TARGET_MANAGER in test_flask_app_usage.py
  • Add cleanup code in the autouse fixture to remove all databases after each test
  • Revert test keys from "v1"/"v2"/"v3" back to "1"/"2"/"3" since the underlying test leakiness is now fixed

Note

Low Risk
Test-only changes that improve isolation by cleaning up shared singleton state; low risk aside from potential flakiness if cleanup interacts with concurrent tests.

Overview
Ensures tests/mock_vws/test_flask_app_usage.py no longer leaks state between tests by importing the singleton TARGET_MANAGER and clearing all cloud and VuMark databases in the autouse fixture teardown via remove_cloud_database/remove_vumark_database.

Updates the duplicate VuMark key test to use simple key values again ("1"/"2"/"3") now that prior test-created databases are reliably cleaned up.

Written by Cursor Bugbot for commit 3bdd91e. This will update automatically on new commits. Configure here.

adamtheturtle and others added 2 commits February 21, 2026 00:21
Reset TARGET_MANAGER state between tests by cleaning up cloud and VuMark databases in the autouse fixture. This fixes the leaky test issue that required workaround keys ("v1", "v2", "v3" instead of "1", "2", "3") in test_duplicate_vumark_keys.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@adamtheturtle adamtheturtle merged commit 795b2a9 into main Feb 21, 2026
106 checks passed
@adamtheturtle adamtheturtle deleted the adamtheturtle/fix-leaky-tests branch February 21, 2026 00:40
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.

1 participant