python-unit-test
Automates unit test creation for Python simulation modules, including edge cases and mocked external dependencies.
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.Key capabilities
- →Detect the active Python test framework and folder conventions
- →Map critical functions, classes, and error paths in target modules
- →Create parameterized tests and mock external dependencies
- →Run target tests and verify failure output
- →Report incremental coverage and uncovered cases
How it works
The skill identifies the test framework, maps module components, and generates parameterized tests with mocked dependencies. It focuses on logic, edge cases, and deterministic testing for simulation and research modules.
Inputs & outputs
When to use python-unit-test
- →Creating simulation engine tests
- →Testing distribution sampling
- →Validating research module logic
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.
When not to use it
- →When testing network or real filesystem interactions without dedicated fixtures
- →When using unseeded randomness in tests
- →When connecting to live MQTT brokers in tests
Limitations
- →Requires an existing test framework (pytest, unittest) or no tests
- →Does not depend on network or real filesystem except for dedicated fixtures
- →Requires reproducible seeds for all tests
How it compares
This skill provides a structured workflow for generating Python unit tests tailored for simulation and research modules, ensuring deterministic and reproducible results, unlike general test writing.
Compared to similar skills
python-unit-test side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| python-unit-test (this skill) | 0 | 4mo | No flags | Intermediate |
| python-testing-patterns | 77 | 2mo | Review | Intermediate |
| backtesting-frameworks | 17 | 2mo | No flags | Advanced |
| temporal-python-testing | 8 | 4mo | No flags | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
python-testing-patterns
wshobson
Implement comprehensive testing strategies with pytest, fixtures, mocking, and test-driven development. Use when writing Python tests, setting up test suites, or implementing testing best practices.
backtesting-frameworks
wshobson
Build robust backtesting systems for trading strategies with proper handling of look-ahead bias, survivorship bias, and transaction costs. Use when developing trading algorithms, validating strategies, or building backtesting infrastructure.
temporal-python-testing
wshobson
Test Temporal workflows with pytest, time-skipping, and mocking strategies. Covers unit testing, integration testing, replay testing, and local development setup. Use when implementing Temporal workflow tests or debugging test failures.
home-assistant-integration-knowledge
home-assistant
Everything you need to know to build, test and review Home Assistant Integrations. If you're looking at an integration, you must use this as your primary reference.
testing-python
jlowin
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, and async testing.
pr-review
pytorch
Review PyTorch pull requests for code quality, test coverage, security, and backward compatibility. Use when reviewing PRs, when asked to review code changes, or when the user mentions "review PR", "code review", or "check this PR".