PY
python-unit-test
Multi-step workflow to create Python unit tests (pytest/unittest) adhering to the repository setup. Tailored for DES simulation and research modules.
Install
mkdir -p .claude/skills/python-unit-test && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/15322" && unzip -o skill.zip -d .claude/skills/python-unit-test && rm skill.zipInstalls to .claude/skills/python-unit-test
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Multi-step workflow to create Python unit tests (pytest/unittest) adhering to the repository setup. Tailored for DES simulation and research modules.149 charsno explicit “when” trigger
About this skill
User Input
$ARGUMENTS
Goal
Create Python unit tests focused on logic, edge cases, and regressions for simulation and research modules.
Bundled assets
templates/test_module_template.py
Workflow
- Detect active framework (
pytestorunittest) and folder conventions. - Map critical functions/classes and error paths in the target module.
- Create parameterized tests and mock external dependencies (MQTT, file I/O).
- Run target tests and verify failure output.
- Report incremental coverage and uncovered cases.
Simulation & Research Test Focus Areas
- DES engine: Verify event ordering, causal correctness, deterministic replay with same seed.
- Station/process logic: Test processing times, resource acquisition, exception paths (jams, failures).
- Distribution sampling: Test that seeded distributions produce reproducible outputs.
- Entity lifecycle: Test creation, state transitions, completion, and discard paths.
- Resource constraints: Test capacity enforcement, queue discipline, blocking behavior.
- Belief updates: Test monotonic refinement — feasible set never expands without new evidence.
- Supervisor constraints: Test that only supervisor-enabled actions are selected.
- Config loading: Test YAML/JSON config parsing, schema validation, default values.
- Event logging: Test that monitor produces correct CSV output without altering simulation state.
- Metric computation: Test metric aggregation, warm-up exclusion, per-seed reproducibility.
Rules
- If
pytestis present, prefer it. - Do not depend on network or real filesystem except for dedicated fixtures.
- Use descriptive test names and single responsibility per test.
- Always test with reproducible seeds — never use unseeded randomness in tests.
- Mock MQTT connections — never connect to live brokers in tests.
- Test that identical seed + config produces identical event logs.