On Mon, Jan 9, 2017 at 8:22 AM,  <m...@influxdb.com> wrote:
> The godoc for (*testing.T).Parallel() only says:
>
>> Parallel signals that this test is to be run in parallel with (and only
>> with) other parallel tests.
>
> Searching for "t.Parallel()" on golang.org shows some usage in
> net/timeout_test.go but little use elsewhere.
>
> I would guess t.Parallel() would be useful for IO-bound tests, but those are
> uncommon in my experience.
>
> It also seems like calling t.Parallel() should be safe on any top-level test
> that runs in a single goroutine and that doesn't rely on any global shared
> state, but for how little I've seen that in the wild, I'm under the
> impression that isn't the intended usage of t.Parallel.

No, that's about right.  But people tend to only call t.Parallel when
they notice that their tests are slow.  If the tests take 1/10 second
anyhow, then there no real impetus to add t.Parallel calls.

In the standard library you'll see extensive use of t.Parallel in the
cmd/go and net/http tests, since those tests take a long time to run.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to