Run Tests
Run the project's test suite and report results honestly, including failures.
Steps
Determine scope from the request:
- A specific file was mentioned → run just that file
- "the tests" or no scope → the whole suite
- "coverage" mentioned → include the coverage flags in step 3
Verify pytest is available:
python -m pytest --versionIf missing, tell the user to run
pip install pytest pytest-covand stop.Run:
python -m pytest <scope> -v --tb=shortWith coverage:
python -m pytest <scope> --cov=src --cov-report=term-missing --cov-report=jsonFor a threshold summary, run
coverage_summary.pyfrom this skill directory against the generatedcoverage.json.Report:
- Pass / fail / skip counts, separately
- For each failure: the test name, the assertion that failed, the file and line
- Coverage percentage and which files fall below 80%, if coverage was run
If tests failed, do not fix them unless asked. Report first — the user may want to see the failure before it disappears.
Interpreting failures
Read the actual assertion before theorising. Common patterns, in rough order of frequency:
- Import errors — a dependency is missing, or the package isn't installed in editable mode. Check that before assuming the test is wrong.
- Fixture errors — the fixture is out of scope or missing from
conftest.py. - Assertion failures — a genuine behavioural difference. Report expected and actual verbatim; do not summarize them.
- Collection errors — a syntax error in the test file. Not a test failure at all.
Constraints
- Never modify a test to make it pass. If a test looks wrong, say so and explain why, then let the user decide.
- Never report success when tests were skipped. Skipped is not passed. Report the skip count separately and say why they skipped.
- Run the full suite before calling a change safe. A passing subset proves nothing about the rest.