Skip to content
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

t.Parallel() #107

Closed
kaihendry opened this issue Sep 9, 2019 · 3 comments · Fixed by #121
Closed

t.Parallel() #107

kaihendry opened this issue Sep 9, 2019 · 3 comments · Fixed by #121

Comments

@kaihendry
Copy link

Can these tests be generated to be run in parallel?

https://twitter.com/peterbourgon/status/1169414085097607168

@cweill
Copy link
Owner

cweill commented Oct 20, 2019

@kaihendry If you'd like to add this as a feature, feel free to submit a PR, and I will approve it.

@skovtunenko
Copy link

Hello, @zolotov!

With this feature merged into the origin/develop, it would be great to take advantage of it in the IntelliJ IDEA/GoLand IDEs.
At least the tc := tc // capture range variable part of the generated code example:

func TestGroupedParallel(t *testing.T) {
    for _, tc := range tests {
        tc := tc // capture range variable
        t.Run(tc.Name, func(t *testing.T) {
            t.Parallel()
            ...
        })
    }
}

Motivation: it's always safer to capture for loop range variables. If someone later on decided to run subtest as Parallel, there would be one less chance to miss the mentioned tc := tc. It looks like this is aligned with Jetbrain's goals to make developer life less error-prone.

@zolotov
Copy link

zolotov commented Apr 30, 2020

@skovtunenko Hi!

I don't think it relates to gotests project, so could you file a feature request on GoLand tracker instead, please? Also, it would be nice if you provide the code with problem to catch, the current code is fine as tc is not used in any goroutine.

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

Successfully merging a pull request may close this issue.

4 participants