Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add testing.T.Context() and testing.B.Context() #5058

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ben-krieger wants to merge 1 commit into tinygo-org:dev
base: dev
Choose a base branch
Loading
from ben-krieger:add-testing-context

Conversation

@ben-krieger
Copy link
Contributor

@ben-krieger ben-krieger commented Oct 1, 2025

b0ch3nski and runcom reacted with thumbs up emoji
}

// Create a subtest.
ctx, cancelCtx := context.WithCancel(context.Background())
Copy link
Contributor Author

@ben-krieger ben-krieger Oct 1, 2025

Choose a reason for hiding this comment

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

It seems kinda weird that the parent context is not from the parent testing.T, but this seems to be how it is in the Go stdlib.

Copy link
Contributor Author

@ben-krieger ben-krieger Oct 1, 2025

Choose a reason for hiding this comment

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

Oh wait, there's specifically a comment on this in the Go stdlib:

There's no reason to inherit this context from parent. The user's code can't observe the difference between the background context and the one from the parent test.

Copy link
Member

aykevl commented Oct 4, 2025

As an alternative, it might be possible to switch to the standard library testing package so we don't need to play catch-up with Go. I've tried it in the past, and I don't think it needs many changes to work. I might look into that later.

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

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /