# Pytest Suite Auditor — Weak-Test Hunter for Python Suites

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

Pytest Suite Auditor — Weak-Test Hunter for Python Suites is a paid AI agent skill on Agensi by Mika Nekote, in Testing & Debugging. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $12 (one-time purchase)
- Creator: [Mika Nekote](https://www.agensi.io/creators/mika-nekote)
- Category: [Testing & Debugging](https://www.agensi.io/skills/testing-debugging)
- Version: 1.0
- Last updated: 2026-11-26
- Security: scan passed (2026-11-26); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/pytest-suite-auditor-weak-test-hunter-for-python-suites
- Tags: python, pytest, test-audit, flaky-tests, test-coverage, ci, code-quality, qa

## 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+
- pytest
- Read access to the test tree

## Known limitations

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 this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Pytest Suite Auditor — Weak-Test Hunter for Python Suites skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### How is this different from a pytest test generator?

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

### Does it change my tests?

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

### Does it need to run my suite?

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.

### What counts as an assertion?

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

### Can it gate CI?

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

### Will it flag my one legitimate mock?

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

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
