Configures and runs pytest - the de facto Python test framework with fixture-based dependency injection (`@pytest.fixture` with scopes module/session/function), parametrize for table-driven tests (`@pytest.mark.parametrize`), markers (`@pytest.mark.skip` / `xfail` / `slow`), `conftest.py` for shared fixtures, plugin ecosystem (pytest-cov, pytest-asyncio, pytest-mock, pytest-xdist), `--lf`/`--ff` for fail-loop, coverage gating. Use when working with Python and needing the modern test framework.
75
94%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Deeper coverage configuration and CI wiring for pytest. The SKILL.md spine
keeps the minimal pytest --cov ... --cov-fail-under=80 command; the
exhaustive config and pipeline wiring live here.
[tool.coverage.run]
source = ["src"]
branch = true
omit = ["**/__init__.py", "**/types.py"]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"if TYPE_CHECKING:",
"raise NotImplementedError",
]
fail_under = 80branch = true enables branch coverage (not just line coverage).
exclude_lines drops lines that can never meaningfully be covered from the
denominator. fail_under mirrors the --cov-fail-under flag as a config
default.
- run: pip install -e .[dev]
- run: pytest --cov --cov-report=xml --cov-fail-under=80 --junitxml=junit.xml
- uses: codecov/codecov-action@v4
with: { files: coverage.xml }--junitxml=junit.xml emits a JUnit report for CI test-result annotations;
--cov-report=xml emits coverage.xml for the coverage uploader.
pytest -n auto # uses CPU countpytest-xdist distributes tests across worker processes. Combine with
coverage via --cov (pytest-cov merges per-worker data automatically).