Skip to content

AnalysisMethod test cleanup should be scoped to test-created IDs #567

Description

@kbighorse

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions