marketplace/bundles/pm-dev-python/skills/pytest-testing/SKILL.md
Use when writing, reviewing, or debugging Python tests — covers pytest framework, AAA pattern, fixtures, parametrization, isolation, mocking, assertions, coverage configuration, and property-based / adversarial testing (Hypothesis). Activate for any Python testing task.
npx skillsauth add cuioss/plan-marshall pytest-testingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
REFERENCE MODE: This skill provides reference material for writing pytest tests. Load standards on-demand based on current task.
Execution mode: Reference library; load standards on-demand for Python testing tasks.
Prohibited actions:
unittest.TestCase for new tests; use plain pytest functionsos.chdir() without restoration (use monkeypatch.chdir())Constraints:
Activate when:
monkeypatch, unittest.mock.patch, state patchingFile: standards/testing-pytest.md (331 lines)
Load When:
Contents:
tmp_path, monkeypatch, _restore_cwd)capsys, capfd)asyncio.run loop-close hangs, calendar time-bombs, pytest-timeout backstop)Load Command:
Read standards/testing-pytest.md
| Topic | Rule |
|-------|------|
| File naming | test_<module>.py |
| Function naming | test_<behavior> — descriptive of what is tested |
| Structure | Arrange-Act-Assert (AAA) |
| Isolation | tmp_path for files, monkeypatch for state, autouse _restore_cwd |
| Fixtures | conftest.py for shared, function scope by default |
| Parametrize | @pytest.mark.parametrize for input variations |
| Property-based / adversarial | Hypothesis @given / strategies / @example (third-party hypothesis dep — user-approval) |
| Exceptions | pytest.raises(ExcType, match="pattern") |
| Approximate | pytest.approx(value, rel=tolerance) |
| Output capture | capsys for Python, capfd for subprocess output |
| Script testing | subprocess.run with capture_output=True, text=True, timeout=30 |
# Via build system
python3 .plan/execute-script.py plan-marshall:build-pyproject:pyproject_build run --command-args "module-tests"
# Specific module
python3 .plan/execute-script.py plan-marshall:build-pyproject:pyproject_build run --command-args "module-tests pm-dev-python"
# With coverage
python3 .plan/execute-script.py plan-marshall:build-pyproject:pyproject_build run --command-args "coverage"
pm-dev-python:python-core - Core Python development patternsplan-marshall:persona-module-tester - Language-agnostic testing methodologydevelopment
Domain-owned OpenRewrite log-line finding parser for the java-cui domain — parses the
development
Domain-owned OpenRewrite marker detection for the java-cui domain — scans Java/Kotlin sources for cui-rewrite TODO markers, categorizes them by recipe, and fails the gate on any detected marker
development
Operator control surface for the marshalld build server — enrol/drop a project in the machine-global registry (the opt-in enable signal and anti-laundering wall), manage the daemon lifecycle (start, stop, drain, status, install, upgrade) version-pinned to the verified bundle copy, and inspect the daemon's per-project interaction-audit log (read-only)
tools
The tiny build-consumption client for the marshalld build server — submit a build job, bounded long-poll for its result, ping the daemon identity, and preflight registry-plus-liveness in one call; consumption only, never provisioning or enrolment