python-testing
/python-testing
Python testing with pytest: fixtures, parametrization, mocking, test organization, async tests, Hypothesis, ExceptionGroup, free-threaded caveats, coverage, and CI hygiene. Use when writing or reviewing Python tests to improve correctness and reduce flakiness.
- Author
- aeondave ↗
- Repository
- malskill ↗
- Licence
- MIT
- Last repository change
- 13.11.2026
Assessment and security
- Files in this package
- 9
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 13.11.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Python testing with pytest: fixtures, parametrization, mocking, test organization, async tests, Hypothesis, ExceptionGroup, free-threaded caveats, coverage, and CI hygiene. Use when writing or reviewing Python tests to improve correctness and reduce flakiness.
Original author description
Python testing with pytest: fixtures, parametrization, mocking, test organization, async tests, Hypothesis, ExceptionGroup, free-threaded caveats, coverage, and CI hygiene. Use when writing or reviewing Python tests to improve correctness and reduce flakiness.
How it works
- When to activate
- Outcome expectations
- Recommended triage workflow
- Core rules
- Resources
SKILL.md preview
--- name: python-testing description: "Python testing with pytest: fixtures, parametrization, mocking, test organization, async tests, Hypothesis, ExceptionGroup, free-threaded caveats, coverage, and CI hygiene. Use when writing or reviewing Python tests to improve correctness and reduce flakiness." license: MIT compatibility: "Python 3.11+ (guidance baseline; current stable CPython 3.14.7). Tools: pytest. Optional: pytest-cov, pytest-asyncio, hypothesis. Free-threaded CI: python3.14t." metadata: author: AeonDave version: "1.3" --- # Python Testing High-signal guidance for writing tests that are **deterministic**, **readable**, and **maintainable**. ## When to activate - Adding tests (unit/integration) for new or existing code - Refactoring tests to reduce flakiness - Designing fixtures and test organization - Adding coverage, CI checks, or async tests - Property tests (Hypothesis) or concurrent/free-threaded suites --- ## Outcome expectations - Tests are deterministic and pass reliably in CI. - Coverage is meaningful; assertions test behavior, not implementation details. - Flaky tests are rare and quickly diagnosed (fixtures, mocking, timing). - New developers can understand test intent within 30 seconds of reading. --- ## Recommended triage workflow **For new code**: Use [test-driven-development](../../coding-behaviours/test-driven-development/SKILL.md) when implementing test-first; it owns the loop and the entry points for existing code and refactors. Use this skill for pytest mechanics. **For flaky/failing tests**: 1. Check for shared state (mocks, fixtures, filesystem). 2. Check for timing assumptions (avoid `sleep`, use synchronization). 3. Check mock patch targets (patch as used, not where defined). 4. Isolate to minimal reproduction in separate test. --- ## Core rules - Prefer **small unit tests** for logic; use integration tests for boundaries. - Use pytest fixtures to remove duplication, but avoid fixture overengineering. - Avoid sleeping in tests; synchronize via conditions/events. - Mock at boundaries (network, time, DB), not everywhere. - Coverage is a signal: aim for meaningful assertions, not line-hits. - Do not add production hooks solely for tests; use real seams or dependency injection. - Pair with `test-driven-development` when implementing persistent code or bug fixes test-first. - If mocks, timing, or flakes dominate, pair with `testing-reliability`; if the root cause is unclear, pair with `systematic-debugging`. - Asyncio-heavy tests: also load `python-async-patterns` `testing.md`. - `CancelledError` and `ExceptionGroup` are not caught by `pytest.raises(Exception)` / `pytest.raises(ValueError)` respectively. --- ## Resources Load on demand: - `references/tdd-and-structure.md` — load when naming and organizing tests; routes test-first work to the shared workflow - `references/fixtures-parametrize.md` — fixtures (scopes, autouse), parametrization patterns - `references/mocking.md` — unittest.mock, patching correctly, async mocks - `references/async.md` — pytest-asyncio loop scope; cancellation/`ExceptionGroup` pointers - `references/concurrency.md` — load for threads, `InterpreterPoolExecutor`, free-threaded suites - `references/property.md` — load when example tests miss a space Hypothesis can shrink - `references/coverage-ci.md` — pytest-cov, coverage hygiene, CI tips - `references/commands.md` — common pytest commands and selectors
Files in this package (9)
- SKILL.md 3 KB
- references/async.md 1 KB
- references/commands.md 1 KB
- references/concurrency.md 2 KB
- references/coverage-ci.md 1 KB
- references/fixtures-parametrize.md 1 KB
- references/mocking.md 1 KB
- references/property.md 1 KB
- references/tdd-and-structure.md 1 KB
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · aeondave/malskill | 100 | MIT |
| microsoft/agent-framework | 100 | MIT |
| Sanit-mann/The-Insectoids | 100 | MIT |
| jelvodev/yaap | 100 | MIT |
| sophophilix/agent-skills | 100 | MIT |
| laurigates/claude-plugins | 100 | MIT |
| dmitriyyukhanov/agent-plugins | 100 | MIT |
| affaan-m/ECC | 100 | MIT |
| usatlas/marketplace | 100 | MIT |
Database snapshot: 13.11.2026 · package version 2be3e3b83b97 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 90testing-python-libraries
Designs and implements pytest test suites for Python libraries with fixtures, parametrization, mocking, Hypothesis property-based testing, and CI configuration. Use when creating tests, improving coverage, setting up testing infrastructure, or implementing property-based testing. - 100testing-python
Write and evaluate effective Python tests using pytest. Use when writing tests, reviewing test code, debugging test failures, or improving test coverage. Covers test design, fixtures, parameterization, mocking, async testing, and CI integration. - 100testing-strategy
This skill should be used when the user is configuring pytest, writing tests, setting up test fixtures, using parametrize, measuring code coverage, writing async tests with pytest-asyncio, using Hypothesis for property-based testing, choosing between nox and tox, building CI… - 90python-testing-patterns
Comprehensive pytest patterns for Python 3.14 / FastAPI — fixtures, parametrize, mocking, async testing, database fixtures, test markers, coverage config, and CI integration. Use when writing or structuring Python test suites beyond the basic TDD cycle. - 95python-testing-patterns
Use when writing or reviewing Python tests - pytest fixtures, parametrize, conftest, mock/patch patterns, pytest-asyncio, hypothesis property-based testing, freezegun/time-machine, factory_boy, and coverage configuration. - 100python-testing-workflow
Set up, run, and improve Python tests in uv projects and workspaces. Use for pytest configuration, focused and package-targeted runs, fixtures, parametrization, async and integration tests, coverage, CI parity, or failure triage.