Pytest Gap Filler: Find Untested Python and Write Tests

    1

    Identify untested Python functions and generate comprehensive pytest suites with edge cases and side-effect isolation.

    $7

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    Pytest Gap Filler: Find Untested Python and Write Tests

    Example session with this skill installed

    Scan src/utils and tests/ for untested functions and write tests for the top 3 most complex gaps found.

    • Read your context and instructions
    • Compiled the pytest gap filler

    I have scanned the directories and identified 8 untested public functions. I prioritized calculate_pro_rata_share, parse_config_env, and validate_transaction_hash due to their branching logic and error handling.

    Coverage Gap Report

    FunctionComplexityTest FileCases Added
    calculate_pro_rata_shareHigh (Math/Branching)tests/test_utils.py5
    parse_config_envMedium (Parsing/IO)tests/test_utils.py4
    validate_transaction_hashMedium (Regex/Validation)tests/test_utils.py3
    import pytest
    from src.utils import calculate_pro_rata_share
    
    def test_calculate_pro_rata_share_happy_path():
        assert calculate_pro_rata_share(100, [50, 50]) == [50, 50]
    
    @pytest.mark.parametrize("total, weights, expected", [
        (100, [1, 1, 1], [33.33, 33.33, 33.34]),
        (0, [1, 2], [0, 0]),
    ])
    def test_calculate_pro_rata_share_boundaries(total, weights, expected):
        # Testing rounding and zero totals
        assert calculate_pro_rata_share(total, weights) == expected
    
    def test_calculate_pro_rata_share_empty_weights():
        with pytest.raises(ValueError, match="Weights list cannot be empty"):
            calculate_pro_rata_share(100, [])
    
    def test_calculate_pro_rata_share_negative_total():
        with pytest.raises(ValueError, match="Total must be non-negative"):
            calculate_pro_rata_share(-1, [1, 1])
    

    Next steps

    1. Review the generated tests in tests/test_utils.py.
    2. Run the full suite with pytest tests/test_utils.py to confirm local environment consistency.
    3. Address the suspected bug in parse_config_env where it fails to handle malformed YAML without a clear error.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Coverage tools show you what is missing, but they do not write the fix. This skill identifies untested Python functions and generates high-quality pytest suites to close those coverage gaps.

    What it does

    • Identify gaps by scanning source and test directories for unreferenced public functions and methods.
    • Rank priorities to focus on complex logic like branching, parsing, or math over trivial getters.
    • Analyze behavior by inspecting inputs, outputs, side effects, and potential exceptions.
    • Generate tests including happy paths, boundary cases, and error handling with pytest.raises.
    • Isolate side effects using tmp_path, monkeypatch, and capsys to ensure hermetic execution.
    • Verify results by running the new tests and reporting whether failures stem from test logic or actual source bugs.

    How it works

    1. Run the gap detection script to generate a lead list of untested functions.
    2. Select high-priority targets based on complexity and business logic.
    3. Inspect the source code to map out inputs, outputs, and edge cases.
    4. Generate and save new tests to the appropriate tests/test_*.py files.
    5. Execute the tests and provide a final report on coverage improvements and suspected bugs.

    Frameworks & tools

    This skill is built for Python projects using the pytest framework. It utilizes standard library tools and pytest fixtures like monkeypatch and tmp_path for isolation.

    Why this beats prompting it yourself

    Standard prompts often produce generic tests that ignore complex branches or fail due to unhandled side effects. This skill follows a systematic discovery process and uses proper test isolation patterns to ensure generated suites are reliable and maintainable.

    Use cases

    • Closing coverage gaps in legacy Python modules.
    • Generating test suites for newly added features before a pull request.
    • Stress-testing complex utility functions with boundary and error cases.
    • Identifying and documenting suspected bugs in untested code paths.

    Known limitations

    Relies on a name-based check for gap detection. Requires a provided scripts/gaps.py or equivalent logic to function.

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Testing & Debugging.

    Relies on name-based matching for gap detection. Requires scripts/gaps.py to be present in the project.

    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 buying a skill.

    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 today

    Permissions

    Terminal / Shell
    Write Files
    Listedtoday

    What's inside

    Frequently Asked Questions

    Unlike standard coverage tools that only identify missing lines, this skill actively analyzes the logic of your untested functions and generates complete, executable pytest files to fill those gaps automatically.

    The skill is designed specifically for Python environments utilizing the pytest framework and is compatible with AI agents that have filesystem access to read source code and write test files.

    Yes, the skill is specifically programmed to identify and isolate side effects using standard pytest fixtures like monkeypatch and tmp_path, ensuring your tests don't interact with your actual filesystem or environment.

    You will receive the specialized AI agent skill logic, the gap detection script for identifying untested functions, and a guide on integrating it into your CI/CD or local development workflow.

    The skill uses a complexity-aware ranking system that prioritizes functions with heavy branching, mathematical logic, or data parsing over simple getters and setters, ensuring your tokens are spent on the most critical code.

    New in Testing & Debugging