Skip to content

CICD-064 · Fail under coverage threshold ​

Encyclopedia · Python CI and uv · All snippets

Previous · CICD-063 · Next · CICD-065

1. Where it fits ​

  • Placement Bash run step following checkout, or equivalent lab terminal.
  • Prerequisites uv or Python dependencies pinned with fixture application and tests.
  • Platforms local-linux, github-actions, gitea-actions.

2. Copy the snippet ​

bash
uv run --locked pytest --cov=app --cov-fail-under=80 --cov-report=xml

3. How it works ​

pytest-cov collects coverage only for the configured target and enforces the threshold when tests finish. The XML report provides evidence beyond the pass status.

4. Verify the result ​

Scope collected modules and ensure the plugin dependency exists.

Validation syntax-validated (Bash parse). Status definitions.