-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Problem
The storage singleton in utils/storage.py is a module-level global. Tests that create remediations, reports, or batch jobs (e.g., test_remediation.py, test_reports.py, test_platforms.py) add data to this shared instance that is never cleared between test runs.
This can cause:
- Order-dependent test failures
- Tests passing in isolation but failing when run together
- Unexpected data from earlier tests affecting later assertions
Suggested Fix
Add a pytest fixture that resets the storage before each test:
@pytest.fixture(autouse=True)
def reset_storage():
storage._reports.clear()
storage._jobs.clear()
storage._remediations.clear()Or better yet, use FastAPI's dependency injection to provide storage per-request in tests.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working