Agent skill · software engineering · aiskillstore
py-testing-async
Async testing patterns with pytest-asyncio. Use when writing tests, mocking async code, testing database operations, or debugging test failures.
Why this skill is useful
Provides specific async testing patterns and configurations for pytest-asyncio that are not commonly known.
What it needs
About 5k tokens when loaded. Last updated 2026-08-07. 405 stars on the source repository.
What this skill does
Python Async Testing Problem Statement Async testing requires specific patterns. pytest-asyncio has modes that affect behavior. Database tests need isolation. Mocking async functions differs from sync. Get these wrong and tests are flaky or don't catch bugs. --- Pattern: pytest-asyncio Configuration Problem: Pytest needs configuration for async tests. --- Pattern: Async Fixtures Problem: Fixtures that provide async resources need specific handling. --- Pattern: Database Test Isolation Problem: Tests polluting each other's database state. --- Pattern: Mocking Async Functions Problem: Regular Mock doesn't work with async functions. --- Pattern: HTTP Client Testing Problem: Testing FastAPI endpoints with async client. --- Pattern: Testing Service Functions --- Pattern: Testing Multi-Step Flows Same principle as frontend - test entire flows, not just units: --- Pattern: Fixture Scopes Problem: Understanding when fixtures are recreated. Best practices: Database sessions: function scope (isolation) Test data: function scope (clean state) Database engine: session scope (expensive to create) --- Pattern: Testing Error Cases --- Pattern: Parameterized Tests --- Common Issues Issue Likely Cause Solution ------- -------------- ---------- "coroutine was never awaited" Missing await in test Add await Test not running async Missing @pytest.mark.asyncio Add marker or use asynciomode = "auto" Tests polluting each other Missing rollback Use transaction fixture with rollback "Event loop is closed" Fixture scope mismatch Check scope on async fixtures Mock not working Using Mock instead of AsyncMock Use AsyncMock for async --- Test Commands
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills aiskillstore/py-testing-async