- Home
- Skills
- Testing & Debugging
- Pytest Suite Auditor — Weak-Test Hunter for Python Suites
Pytest Suite Auditor — Weak-Test Hunter for Python Suites
by Mika Nekote
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
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
| Metric | Value |
|---|---|
| Files Scanned | 12 |
| Tests Found (Static) | 84 |
| Tests Collected (Pytest) | 84 |
| Total Findings | 7 |
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 broadtry/except Exception: passblock.
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 assertionassert 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 withpytest.warnsor 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
- Apply the fixes for
NO_ASSERTandSWALLOWED_ASSERTimmediately to regain test signal. - Replace
time.sleepin the MFA tests to stabilize CI duration. - Run
python scripts/audit_suite.py ./tests/authto 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
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 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
What's inside
Frequently Asked Questions
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.