TEST003warningPro

async-mock-issues

Async function mocked incorrectly.

Applies to: Python

Why this matters

Mocking async functions requires AsyncMock, not regular Mock. Using Mock for async functions returns a Mock object instead of a coroutine, causing 'object Mock can't be used in await expression' errors.

Catch it before it ships

pip install stablestack # or: npx stablestackstablestack # scans your project, TEST003 includedstablestack explain TEST003

TEST003 is part of the Pro rule set. See pricing — the free tier ships 24 checks with no signup.

False positive in your codebase? Suppress a single line with # noqa: TEST003