Context
Identified during review of #558 (558-radionuclides-backfill branch).
Problem
The after_scenario cleanup iterates over ALL AnalysisMethod records and deletes any with zero observations. This is overly aggressive — in a shared test database it can delete methods created by other fixtures or seed data.
The _backfill_created tracking dict already has an analysis_method_ids key but it is never populated by the backfill code.
Fix
Track AnalysisMethod IDs created during the backfill (populate context._backfill_created["analysis_method_ids"] in the step definitions or backfill code) and only delete those specific IDs during cleanup.
Files
tests/features/environment.py (lines ~810–817)
tests/features/steps/chemistry-backfill.py (_backfill_created dict)
Context
Identified during review of #558 (
558-radionuclides-backfillbranch).Problem
The
after_scenariocleanup iterates over ALLAnalysisMethodrecords and deletes any with zero observations. This is overly aggressive — in a shared test database it can delete methods created by other fixtures or seed data.The
_backfill_createdtracking dict already has ananalysis_method_idskey but it is never populated by the backfill code.Fix
Track AnalysisMethod IDs created during the backfill (populate
context._backfill_created["analysis_method_ids"]in the step definitions or backfill code) and only delete those specific IDs during cleanup.Files
tests/features/environment.py(lines ~810–817)tests/features/steps/chemistry-backfill.py(_backfill_createddict)