Enforce Python behavior coverage and mutation checks #15

Open
opened 2026-11-01 20:11:34 +00:00 by viacheslavshuka · 0 comments

Passing example tests alone does not establish coverage of every required business rule. Configure checks that report missing behavior and failed infrastructure accurately.

Scope

Provide typed pytest, pytest-asyncio, HTTPX, Hypothesis, coverage.py or pytest-cov, and mutmut commands. Separate fast core tests from database and system tests. Configure the full production scope as application modules appear.

Acceptance criteria

  • The fast command tests core behavior without database or network services. Integration commands use PostgreSQL Testcontainers with synthetic data and isolated state.
  • Async resources remain within their owning event loop. Fixtures close pools, clients, and containers after passing tests, test failures, or setup failures.
  • Statement and branch reports include every project-owned production module, including unimported modules. Reports exclude tests, generated output, bundled skills, and third-party code.
  • Business rules and failure paths require complete statement and branch coverage with meaningful assertions. Adapter and startup gaps require individual review.
  • A separate mutation command covers the complete existing application core after ordinary tests pass. It reports equivalent mutations separately from unresolved behavior-changing survivors.
  • Mutation timeouts, crashes, empty erroneous selections, and collection failures cannot count as detected mutants. Unresolved behavior-changing survivors fail the required result.
  • Functional tests do not receive automatic retries that convert a failure into success. Required PostgreSQL tests fail when the container runtime is unavailable.
  • The complete local command runs the applicable full suite. CI can run independent groups concurrently without changed-file omissions.
  • The initial runtime and representative validation fixtures demonstrate that the configuration detects failures. It does not invent domain rules to produce coverage numbers.

Validation

Demonstrate detection of an unimported production module, a missing branch, and a behavior-changing mutant in disposable validation fixtures. Show that a database connection from another test cannot observe leaked mutable state. Preserve original failure evidence.

Dependencies

Passing example tests alone does not establish coverage of every required business rule. Configure checks that report missing behavior and failed infrastructure accurately. ## Scope Provide typed pytest, pytest-asyncio, HTTPX, Hypothesis, coverage.py or pytest-cov, and mutmut commands. Separate fast core tests from database and system tests. Configure the full production scope as application modules appear. ## Acceptance criteria - The fast command tests core behavior without database or network services. Integration commands use PostgreSQL Testcontainers with synthetic data and isolated state. - Async resources remain within their owning event loop. Fixtures close pools, clients, and containers after passing tests, test failures, or setup failures. - Statement and branch reports include every project-owned production module, including unimported modules. Reports exclude tests, generated output, bundled skills, and third-party code. - Business rules and failure paths require complete statement and branch coverage with meaningful assertions. Adapter and startup gaps require individual review. - A separate mutation command covers the complete existing application core after ordinary tests pass. It reports equivalent mutations separately from unresolved behavior-changing survivors. - Mutation timeouts, crashes, empty erroneous selections, and collection failures cannot count as detected mutants. Unresolved behavior-changing survivors fail the required result. - Functional tests do not receive automatic retries that convert a failure into success. Required PostgreSQL tests fail when the container runtime is unavailable. - The complete local command runs the applicable full suite. CI can run independent groups concurrently without changed-file omissions. - The initial runtime and representative validation fixtures demonstrate that the configuration detects failures. It does not invent domain rules to produce coverage numbers. ## Validation Demonstrate detection of an unimported production module, a missing branch, and a behavior-changing mutant in disposable validation fixtures. Show that a database connection from another test cannot observe leaked mutable state. Preserve original failure evidence. ## Dependencies - [#6: Start the FastAPI runtime with owned database resources](https://code.viacheslavshuka.com/viacheslavshuka/quorum/issues/6). Lifecycle tests need the executable runtime. - [#8: Apply PostgreSQL migrations with release compatibility checks](https://code.viacheslavshuka.com/viacheslavshuka/quorum/issues/8). Persistence tests must apply real migrations. ## Related work - [#13: Enforce complete validation in the shared Forgejo runner flow](https://code.viacheslavshuka.com/viacheslavshuka/quorum/issues/13)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
viacheslavshuka/quorum#15
No description provided.