pytest-test_skill

This skill executes and generates pytest tests for Python projects, including fixtures, parametrization, and mocking support to boost test quality.
  • JavaScript

9

GitHub Stars

3

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill fortiumpartners/ai-mesh --skill pytest-test

  • generate-test.py1.5 KB
  • run-test.py1.0 KB
  • SKILL.md1.4 KB

Overview

This skill executes and generates pytest tests for Python projects, focusing on fixtures, parametrization, and mocking support. It produces test files from templates and runs tests with structured JSON output to drive automation and CI feedback. The skill is designed to create failing tests for debugging workflows and to verify fixes by re-running test suites.

How this skill works

The skill inspects a Python source file or project to generate pytest-compatible test files using configurable templates (unit, integration, etc.). It supports fixtures, parametrized cases, and mock/monkeypatch patterns when producing tests. Test execution runs pytest via a runner script and returns a structured JSON summary with pass/fail counts, duration, and detailed failure entries to aid automated analysis.

When to use it

  • Generate unit tests quickly from a Python source file to capture edge cases such as exceptions
  • Automate test creation and execution as part of a debug workflow that needs reproducible failing tests
  • Run targeted test files in CI with machine-readable results for reporting or gating
  • Verify fixes by regenerating and re-running tests after code changes
  • Create parametrized test suites to validate multiple input combinations efficiently

Best practices

  • Use descriptive test descriptions when generating tests so failures are easy to interpret
  • Prefer fixtures for shared setup and parametrization for variant inputs to keep tests concise
  • Include clear assertions and exception expectations (e.g., pytest.raises) for edge cases
  • Keep generated tests small and focused—one behavior per test—so failures pinpoint the issue
  • Integrate the runner output into CI or a debugger pipeline using the JSON summary for automation

Example use cases

  • Generate a failing unit test that reproduces a division-by-zero bug and run it to confirm failure
  • Create parametrized tests for a calculation function to cover multiple input ranges in one file
  • Mock external dependencies in generated tests to isolate logic under test
  • Run a specific test file in a CI job and parse the JSON output to publish test metrics
  • Drive an automated repair loop: generate failing test, fix code, re-run to verify passing

FAQ

Test execution returns a JSON summary with success flag, passed/failed counts, total, duration, and detailed failure entries including file and line.

Can generated tests use fixtures and mocks?

Yes. The generator supports fixtures, parametrization, and mock/monkeypatch patterns to create realistic and isolated tests.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational