PY

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.zip

Installs 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
Intermediate

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

You give it
Target Python module for testing
You get back
Python unit tests (pytest/unittest) for the module

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

  1. Detect active framework (pytest or unittest) and folder conventions.
  2. Map critical functions/classes and error paths in the target module.
  3. Create parameterized tests and mock external dependencies (MQTT, file I/O).
  4. Run target tests and verify failure output.
  5. 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 pytest is 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.

SkillInstallsUpdatedSafetyDifficulty
python-unit-test (this skill)04moNo flagsIntermediate
python-testing-patterns772moReviewIntermediate
backtesting-frameworks172moNo flagsAdvanced
temporal-python-testing84moNo flagsAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

Search skills

Search the agent skills registry