- Home
- Skills
- Testing & Debugging
- Python Test Generator Skill
Works with the AI Agents you already use
Python Test Generator Skill
Generate runnable Python tests and plain-English quality reports to find bugs and coverage gaps.
$4.99
Python Test Generator Skill
Example session with this skill installed
Here is a function that calculates a discount. Please generate pytest tests and a report:
def get_discount(price, code):
if code == 'SAVE10': return price * 0.9
return price
- Read your context and instructions
- Compiled the python test generator
I have analyzed the get_discount function. It implements a simple conditional discount based on a string literal.
Plain-English Python Test Report
1. Quick Verdict
The code is functional for the 'SAVE10' case but lacks validation for negative prices, non-numeric inputs, or case-insensitive codes. These tests are currently
NOT RUN.
2. What the Code Appears to Do
It accepts a price and a code string. If the code matches 'SAVE10' exactly, it returns 90% of the price. Otherwise, it returns the original price. It assumes price is a number that supports multiplication.
3. Test Plan
| Priority | Behavior | Test scenario | Expected result |
|---|---|---|---|
| P0 | Valid Discount | code='SAVE10', price=100 | 90.0 |
| P1 | No Discount | code='WRONG', price=100 | 100.0 |
| P1 | Boundary Case | price=0 | 0.0 |
| P2 | Input Integrity | price=-50 | Error or logic handling |
4. Generated Tests
import pytest
from discount_module import get_discount
def test_apply_valid_discount():
assert get_discount(100, 'SAVE10') == 90.0
def test_no_discount_invalid_code():
assert get_discount(100, 'OTHER') == 100.0
def test_zero_price():
assert get_discount(0, 'SAVE10') == 0.0
@pytest.mark.parametrize("bad_price", [-10, "100"])
def test_input_resilience(bad_price):
# This identifies if the code breaks or allows negative discounts
assert get_discount(bad_price, 'SAVE10') is not None
5. Test Results
- NOT RUN:
test_apply_valid_discount - NOT RUN:
test_no_discount_invalid_code - NOT RUN:
test_zero_price - NOT RUN:
test_input_resilience
8. Unfinished or Uncertain Areas
- Likely: The function does not handle lowercase codes (e.g., 'save10').
- Needs Verification: Behavior when
priceis a string orNone.
10. Exactly What to Do Next
- P0: Implement input validation to ensure
priceis a positive float/int. - P1: Decide if 'SAVE10' should be case-insensitive and update the
ifstatement. - P2: Add a docstring to define the expected return type.
11. How to Run
pytest -v**
Connects securely to your tools. The creator never sees your data.
About this skill
Software testing often feels like a black box of cryptic tracebacks and incomplete coverage metrics. This skill acts as a senior Python test engineer to bridge the gap between source code and actionable quality reports. It analyzes your Python functions or modules to generate focused, runnable test suites while providing a plain-English breakdown of what your code actually does versus what remains unverified.
The skill prioritizes high-impact scenarios over vanity metrics. It generates pytest or unittest suites that target edge cases, boundary conditions, and potential failures without requiring you to manually map out every test case. Beyond just writing code, it audits your implementation for TODO markers, unfinished logic, and unhandled exceptions, delivering a prioritized P0-P2 action plan for repairs.
What it does
- Generate test suites creates runnable
pytestorunittestcode for functions, classes, and full modules. - Map behavior identifies public entry points, side effects, and external dependencies for systematic testing.
- Analyze failures explains tracebacks by comparing actual results against intended contracts and identifying root causes.
- Audit coverage gaps highlights missing test scenarios and unverified code branches based on static inspection.
- Identify risks flags
passstatements, incomplete validation, and risky state-handling for immediate review.
How it works
- Submit code by pasting a function, module, or existing test log into the chat.
- Review the test plan to see a prioritized table of behaviors and expected outcomes.
- Run generated tests using the provided environment setup and execution commands.
- Iterate on findings by following the plain-English report to fix identified bugs or implement missing features.
Frameworks & tools
This skill defaults to pytest but supports unittest and standard Python library structures. It handles mocks for network calls, file systems, and external services using unittest.mock.
Why this beats prompting it yourself
Generic prompts often result in redundant tests or hallucinated pass/fail results. This skill enforces a strict reporting structure that distinguishes between verified execution and static hypotheses, ensuring you never mistake a proposed test for a successful one.
Use cases
- Unit testing new functions to ensure they handle malformed inputs and boundary cases.
- Refactoring legacy code by creating a safety net of tests before changing implementation details.
- Debugging failures by providing a traceback and receiving a plain-English explanation of the likely cause.
- Pre-PR audits to catch
TODOcomments or unhandled exceptions before they reach code review.
Known limitations
Does not guarantee bug-free software. Cannot measure actual execution coverage without a provided runtime environment or coverage report. Requires manual execution of generated tests.
Cannot claim tests passed without execution results. Requires manual setup of dependencies. Does not invent business logic for ambiguous code. Limited to Python ecosystem.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 12 days ago
- Software
Python
Permissions
No special permissions declared or detected