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.

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.

1 participant