Pytest Suite Auditor — Weak-Test Hunter for Python Suites

    by Mika Nekote

    1

    Your suite is green. Is it honest? Audit existing pytest tests for the ones that can't fail — no asserts, tautologies, swallowed failures, sleeps, mock theatre, duplicates — and get a severity-ranked fix list.

    $12

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    Pytest Suite Auditor — Weak-Test Hunter for Python Suites

    Example session with this skill installed

    Audit the tests in ./tests/auth and give me a report. This is a local dev environment, so profiling is safe to run.

    • Read your context and instructions
    • Compiled the pytest suite auditor

    I have completed the audit of the ./tests/auth directory. I performed both a static AST scan and an execution profile with a 1.0s threshold.

    Pytest Audit Report

    MetricValue
    Files Scanned12
    Tests Found (Static)84
    Tests Collected (Pytest)84
    Total Findings7

    Critical & High Severity

    • CRITICAL: NO_ASSERT
      tests/auth/test_flows.py:42 - test_login_redirect
      Finding: Test contains no assertion statements.
      Fix: Add assertions to verify the response status code and location header.

    • HIGH: SWALLOWED_ASSERT
      tests/auth/test_utils.py:115 - test_token_generation
      Finding: Assertions inside a broad try/except Exception: pass block.
      Fix: Remove the try/except block or catch specific exceptions without swallowing the failure.

    • HIGH: WEAK_ASSERT
      tests/auth/test_api.py:22 - test_get_user_profile
      Finding: Tautological assertion assert len(response_data) >= 0.
      Fix: Assert against specific expected keys or a minimum realistic length.

    Medium & Low Severity

    • MEDIUM: SLEEP
      tests/auth/test_flows.py:89 - test_mfa_timeout
      Finding: time.sleep(2) detected.
      Fix: Replace with pytest.warns or a polling/retry helper.

    • MEDIUM: MOCK_HEAVY
      tests/auth/test_service.py:54 - test_external_auth_provider
      Finding: 5 mocks used with only 1 assertion.
      Fix: Refactor to use an integration test or reduce mocking surface.

    Execution Profiling (Slow Tests)

    • SLOW_TEST: tests/auth/test_flows.py:121 - test_password_hashing_load (1.42s)
    • SLOW_TEST: tests/auth/test_api.py:67 - test_batch_permission_check (1.15s)

    Next steps

    1. Apply the fixes for NO_ASSERT and SWALLOWED_ASSERT immediately to regain test signal.
    2. Replace time.sleep in the MFA tests to stabilize CI duration.
    3. Run python scripts/audit_suite.py ./tests/auth to verify the count of high-severity findings is zero.

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

    About this skill

    Test generators write new tests. Nobody checks the ones you already have — and every long-lived pytest suite quietly accumulates tests that pass no matter what: the assert True left from debugging, the test with no assertion at all, the one whose try/except swallows its own failure, the copy-paste duplicate, the test that mostly verifies its own mocks.

    Pytest Suite Auditor makes your agent audit an existing suite the way a sceptical reviewer would, and prove every finding with a tool, not an opinion:

    • Cannot-fail detection. AST analysis finds no-assert tests, constant/tautological assertions (assert x == x, assert len(x) >= 0), is not None-only tests, and assertions swallowed by try/except.
    • Flake & speed risks. Every time.sleep / wait_for_timeout, plus — with an optional real run — the slowest tests by measured duration, not vibes.
    • Signal dilution. Mock-heavy tests (more mocks than assertions), identical duplicate bodies, and drifted copies asserting the same things.
    • Fixture problems. Session-scoped fixtures handing out shared mutable state, and fixtures nobody requests.
    • Severity-ranked report. Critical → info, each finding with file:line and a concrete fix, in console, Markdown and JSON. Exit code gates CI: the audit fails the build on high+ findings.
    • Audit only — nothing is rewritten. The skill's workflow forbids silently editing the suite. You get evidence and a fix order; changes stay yours to approve.

    What's included:

    • SKILL.md — The audit workflow: collect → static analysis → optional profiling → severity report → fix order
    • scripts/audit_suite.py — The auditor itself: stdlib-only AST analysis + pytest profiling, Markdown/JSON reports
    • reference/audit-rules.md — Every rule, severity definition, and the sanctioned fix — including what is deliberately NOT flagged
    • examples/weak_suite/ — A demo suite with planted weaknesses to audit
    • examples/clean_suite/ — A healthy suite the auditor passes silently
    • examples/expected/ — The exact report the weak suite must produce

    Who it's for: Python teams inheriting a suite they don't trust, leads preparing a refactor ("can we lean on these tests?"), and anyone whose CI is green while bugs keep slipping through.

    Requirements: Python 3.10+ and pytest (for collection counts and profiling); read access to the test tree — the auditor never writes to it; an agent that can read SKILL.md-style skill packages.

    Requires Python 3.10+ for static AST analysis. Profiling requires a working environment where tests can execute. Does not support non-pytest frameworks.

    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 9 days ago

    Software
    Python 3.10+pytestRead access to the test tree

    Permissions

    Terminal / Shell
    Browser
    Read Files
    Write Files
    Environment Variables
    Listed9 days ago

    What's inside

    Creator

    M

    Mika Nekote

    2 skills on Agensi

    Frequently Asked Questions

    Generators write new tests; this audits the ones you have. Different job, no overlap.

    No. The auditor is read-only and the workflow forbids silent edits.

    The static audit never executes your tests — it parses them. Durations are optional; the agent must confirm before profiling a suite that touches shared services.

    Real asserts, pytest.raises, Playwright expect(...), unittest-style self.assert*, and expect_* helper calls.

    Yes. --fail-on sets the severity that exits 1 (default: high). JSON output feeds dashboards; Markdown drops into a PR comment.

    No. MOCK_HEAVY needs ≥3 mock/patch calls and more mocks than assertions in a single test.

    New in Testing & Debugging

    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.