-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
testing: update documentation to be clear about when parallel subtests run #23368
Comments
Note that Go 1.10 has updated wording here: current: https://golang.org/pkg/testing/#T.Run go1.10 says:
That was added in d452986 for #22993. Is that sufficient? |
#22993 also bit me, and led to the code in this example that deadlocks. I don't think the doc update is sufficient. There is still a critical bit of information missing:
|
Also hit this. There is definitely a lot more detail necessary in the doc for |
Also, what may not be obvious on first look: func TestMain(t *testing.T) {
setup()
defer teardown()
for name, tt := range testCases {
t.Run(name, func(t *testing.T) {
t.Parallel()
doStuff()
})
}
}
Is there any possibility to make this "work as expected"? |
@tommyknows That is best discussed in a forum, not on this issue. Let's not clutter up the issue. Thanks. https://golang.org/wiki/Questions. |
@tommyknows put them in a group func TestMain(t *testing.T) {
setup()
defer teardown()
t.Run("group", func(t *testing.T) {
for name, tt := range testCases {
t.Run(name, func(t *testing.T) {
t.Parallel()
doStuff()
})
}
})
} |
What version of Go are you using (
go version
)?go version go1.9.2 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?What did you do?
go test -v
with the following code:What did you expect to see?
All statements print and test completes
What did you see instead?
Test hangs after "deferred done" and "waiting" are printed.
This is explained by the following comment in the blog post introducing subtests.
But I cannot find this mentioned anywhere in the documentation for the
testing
package.It seems like we at least need to update those docs with the appropriate details.
The text was updated successfully, but these errors were encountered: