Skip to content

Conversation

ben-krieger
Copy link
Contributor

}

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

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

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.

@aykevl
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants