CtrlK
BlogDocsLog inGet started
Tessl Logo

testland/pytest-asyncio-patterns

Configures and runs async Python tests with pytest-asyncio: installs the plugin, selects asyncio_mode (auto vs strict), scopes event loops (function/class/module/session), writes async fixtures with @pytest_asyncio.fixture, mocks coroutines with AsyncMock, and tests FastAPI (httpx.AsyncClient + ASGITransport) and aiohttp (aiohttp_client fixture) applications. Use when a Python project contains async def test_ functions, FastAPI/aiohttp endpoints, or any asyncio-based code that needs pytest integration. Do NOT use for general pytest fixture design, parametrize patterns, or conftest.py structure without an asyncio-specific problem (event-loop scoping, mode config, AsyncMock, ASGI client): use python-unit-tests for those.

93

Quality

93%

Does it follow best practices?

Impact

Average score across 10 eval scenarios

SecuritybySnyk

Passed

No findings from the security scan

Overview
Quality
Evals
Security
Files

Quality

Content

86%Weight 40%Scale 1-5

Reviews the quality of instructions and guidance provided to agents. Good implementation is clear, handles edge cases, and produces reliable results.

The content is a well-structured, highly actionable skill with excellent progressive disclosure and executable examples throughout. The only meaningful gap is the absence of explicit validation/checkpoint feedback loops, which limits workflow_clarity to 4.

Suggestions

Add an explicit verify-after-config checkpoint (e.g. run `pytest --co -q` or a smoke test after setting asyncio_mode/loop_scope) so the workflow has a clear feedback loop at Step 2 or 4 rather than only in Step 1.

Tighten the Overview and the Step 6 MagicMock rationale to remove prose that restates what pytest-asyncio does, trimming toward the lean anchor-5 conciseness style.

Consider a short 'Verify it works' subsection after Step 5 (async fixtures) showing a minimal failing-then-passing check, mirroring the validate-fix-retry pattern expected for higher workflow_clarity.

DimensionReasoningScore

Conciseness

The body is dense and task-focused with minimal concept padding, but the Overview and a few prose justifications (e.g. the MagicMock / inspect.iscoroutinefunction explanation in Step 6) could be trimmed slightly. Sits above 'mostly efficient' but not fully lean.

4 / 5

Actionability

Every step provides copy-paste-ready executable code or commands: install commands, pyproject.toml snippets, marker and pytestmark examples, async fixture code, an AsyncMock example, and a FastAPI AsyncClient example covering the common cases.

5 / 5

Workflow Clarity

A clear 7-step sequence (Install through Test frameworks) with a verify hint in Step 1 and decision tables for mode/scope, but explicit validate->fix->retry checkpoints are absent. Since the workflow is non-destructive, the destructive cap does not apply; minor validation gaps place it at 4 rather than 5.

4 / 5

Progressive Disclosure

The spine is an overview with two real, clearly signaled one-level-deep references (references/asyncmock-assertions.md and references/framework-clients.md, both verified to exist) linked inline at the relevant steps, plus a consolidated References section; content is appropriately split and easy to navigate.

5 / 5

Total

18

/

20

Passed

Description

100%Weight 40%Scale 1-5

Based on the skill's description, can an agent find and select it at the right time? Clear, specific descriptions lead to better discovery.

The description is exemplary: it enumerates concrete capabilities, provides explicit positive and negative trigger guidance, and sharply distinguishes itself from the adjacent python-unit-tests skill. No substantive weaknesses to address.

DimensionReasoningScore

Specificity

Lists multiple specific concrete actions with comprehensive coverage: installs the plugin, selects asyncio_mode (auto vs strict), scopes event loops (function/class/module/session), writes async fixtures with @pytest_asyncio.fixture, mocks coroutines with AsyncMock, and tests FastAPI and aiohttp applications.

5 / 5

Completeness

Explicitly answers both what (configures and runs async Python tests with pytest-asyncio, enumerating capabilities) and when ('Use when a Python project contains async def test_ functions, FastAPI/aiohttp endpoints, or any asyncio-based code that needs pytest integration') with concrete trigger phrases.

5 / 5

Trigger Term Quality

Comprehensive natural terms including the literal 'async def test_ functions' a user would write, plus framework and library names (pytest-asyncio, AsyncMock, httpx.AsyncClient, ASGITransport, aiohttp_client) and synonyms like 'asyncio-based code'.

5 / 5

Distinctiveness Conflict Risk

Clear asyncio+pytest niche with explicit negative boundary guidance ('Do NOT use for general pytest fixture design, parametrize patterns, or conftest.py structure... use python-unit-tests for those'), minimizing overlap with the nearest neighbor skill.

5 / 5

Total

20

/

20

Passed

Validation

93%

Checks the skill against the spec for correct structure and formatting. All validation checks must pass before discovery and implementation can be scored.

Validation15 / 16 Passed

Validation for skill structure

CriteriaDescriptionResult

metadata_version

'metadata.version' is missing

Warning

Total

15

/

16

Passed

Reviewed

Table of Contents