Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    Python Test Generator Skill

    1

    Generate runnable Python tests and plain-English quality reports to find bugs and coverage gaps.

    $4.99

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    Python Test Generator Skill

    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

    PriorityBehaviorTest scenarioExpected result
    P0Valid Discountcode='SAVE10', price=10090.0
    P1No Discountcode='WRONG', price=100100.0
    P1Boundary Caseprice=00.0
    P2Input Integrityprice=-50Error 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 price is a string or None.

    10. Exactly What to Do Next

    1. P0: Implement input validation to ensure price is a positive float/int.
    2. P1: Decide if 'SAVE10' should be case-insensitive and update the if statement.
    3. 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 pytest or unittest code 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 pass statements, incomplete validation, and risky state-handling for immediate review.

    How it works

    1. Submit code by pasting a function, module, or existing test log into the chat.
    2. Review the test plan to see a prioritized table of behaviors and expected outcomes.
    3. Run generated tests using the provided environment setup and execution commands.
    4. 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 TODO comments 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. 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. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

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

    Listed12 days ago

    What's inside

    Frequently Asked Questions

    This skill acts as an automated quality engineer that writes runnable pytest/unittest code while translating complex code behaviors into plain-English reports, helping you find edge cases you might have missed.

    The skill supports standard Python code using `pytest` and `unittest` frameworks, and it can generate mocks for external dependencies like APIs or databases using `unittest.mock`.

    No complex installation is required; simply paste your Python functions or modules directly into your AI agent's chat interface to begin the analysis and test generation process.

    While the skill performs deep static analysis to identify risks and missing branches, you must run the generated code in your local environment to verify actual execution and coverage metrics.

    You receive the full test generation logic, a structured reporting framework for auditing code quality, and access to all future logic updates and framework compatibility patches.

    The skill is highly effective at testing business logic and data processing, though it may require additional manual configuration for testing complex GUI elements or hardware-specific drivers.

    New in Testing & Debugging