Spaces:
Running

bha-Search / MUTATION_TESTING.md
vomebook's picture
Add scoped mutation tests and enforce 80% coverage
26bf5fd verified
|
Raw History Blame Contribute Delete
1.39 kB

BHA mutation testing

Install the ordinary test dependencies and requirements-mutation.txt, then run npm run mutation. The runner copies the current Python sources and test into a temporary directory, checks exact mutmut and pytest versions, executes mutmut, checks that the original files did not change, and requires 80% killed/total. No source data, repository checkouts, production service, or pipeline is used.

The current campaign targets the whole app/parse_core.py module using tests/test_parse_core.py; it does not claim whole-application mutation coverage. Mutmut 3 generates mutations inside functions, not module-level or class-body statements, including Pydantic field declarations. Untested mutants remain in the denominator. A timeout, skipped, interrupted, suspicious, or crashed run fails instead of being counted as a successful kill. Surviving mutants and their identities are printed; use python -B tests/run_mutation.py --report /path/to/report.json --min-score 80 to save evidence. A score is not a substitute for corpus or browser tests.

The production Docker build enforces the separately measured 80% combined Python statement/branch coverage, strict types, and the mutation-runner's own tests. Full mutation campaigns are an explicit separate command, not run inside the release build; the mutation tool is not installed in the runtime.