Skip to content

Document async stub call and await tracking - #627

Merged
nicoddemus merged 3 commits into
pytest-dev:mainfrom
xiehuanyi:docs/async-stub-awaits-20261012-r2
Oct 17, 2026
Merged

nicoddemus merged 3 commits into
pytest-dev:mainfrom
xiehuanyi:docs/async-stub-awaits-20261012-r2

Conversation

@xiehuanyi

Copy link
Copy Markdown
Contributor

The stub documentation only briefly mentions async_stub. A call is recorded even if its coroutine is never awaited, so checking called alone can miss an incorrectly invoked async callback.

Add a complete example that checks both invocation and awaiting, and explain when to use assert_awaited_once_with/await_count. Refs #374; the existing AsyncMock behavior is retained.

Validation: the documented pytest-asyncio example runs successfully; the HTML documentation builds with warnings treated as errors; applicable pre-commit checks pass.

Prepared with OpenAI Codex (GPT-6.1 Sol, xhigh), including this description.

Copilot AI balanced review requested due to automatic review settings October 12, 2026 19:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

xiehuanyi and others added 2 commits October 17, 2026 11:18
Clarify that the mock records calls (assertions only check them),
document call and await tracking in the async_stub docstring, and link
the changelog entry to pytest-dev#627.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nicoddemus
nicoddemus force-pushed the docs/async-stub-awaits-20261012-r2 branch from b6aa258 to 1b9cc42 Compare October 17, 2026 14:19
@nicoddemus

nicoddemus commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Thanks!

@nicoddemus
nicoddemus merged commit d26d41b into pytest-dev:main Oct 17, 2026
18 checks passed
@nicoddemus nicoddemus mentioned this pull request Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants