Skip to content

Annotate async expectations with awaitNotRequired - #2700

Open
natebosch wants to merge 1 commit into
masterfrom
await-not-required
Open

Annotate async expectations with awaitNotRequired#2700
natebosch wants to merge 1 commit into
masterfrom
await-not-required

Conversation

@natebosch

Copy link
Copy Markdown
Member

Closes #2139

Asynchronous expectations which return a Future already use
TestHandle.current.markPending() so that test cases are not considered
complete until after the expectations are complete. Some uses will want
to await anyway to maintain execution order in tests, but it's valid
to "fire and forget" asynchronous expectations when execution order
doesn't matter. Annotate with @awaitNotRequired so this is explicit
and the unawaited_futures lint is suppressed at call sites.

Closes #2139

Asynchronous expectations which return a `Future` already use
`TestHandle.current.markPending()` so that test cases are not considered
complete until after the expectations are complete. Some uses will want
to `await` anyway to maintain execution order in tests, but it's valid
to "fire and forget" asynchronous expectations when execution order
doesn't matter. Annotate with `@awaitNotRequired` so this is explicit
and the `unawaited_futures` lint is suppressed at call sites.
@natebosch
natebosch requested a review from jakemac53 July 18, 2026 04:49
@natebosch
natebosch requested a review from a team as a code owner July 18, 2026 04:49
@github-actions github-actions Bot added the package:checks Issues related to pkg:checks label Jul 18, 2026
@github-actions

Copy link
Copy Markdown

PR Health

Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

This check can be disabled by tagging the PR with skip-changelog-check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package:checks Issues related to pkg:checks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[checks] Expectations that return futures do not play well with the unawaited_futures lint

2 participants