README

go-testparallel

CircleCI Go Report Card Go docs

Go package that provides a function for making all tests in a suite run in Parallel without adding t.Parallel() to every test.

See Go docs for usage.

Documentation

Overview

    Package testparallel provides a function for making all tests in a package run in Parallel without needing to add the line `t.Parallel()` to the beginning of every test in a package.

    Call All inside TestMain to enable parallel for all top-level tests:

    func TestMain(m *testing.M) {
    	testparallel.All(m)
    	os.Exit(m.Run())
    }
    

    Warning: Uses unsafe and is dependent on unexported fields, and may become unpredictable or not work with changes to the Go standard library. Use at your own risk.

    Index

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    func All

    func All(m *testing.M)

      All wraps all the top-level tests in the testing.M with a function that first calls t.Parallel().

      Sub-tests are unaffected and still run in sequence.

      Call All inside TestMain:

      func TestMain(m *testing.M) {
      	testparallel.All(m)
      	os.Exit(m.Run())
      }
      

      Warning: Uses unsafe and is dependent on unexported fields, and may become unpredictable or not work with changes to the Go standard library. Use at your own risk.

      Types

      This section is empty.

      Source Files