Explicitly load test configuration when needed
Explicitly configures test configuration for packages that need it. This removes the import side effects of testhelpers package and makes it safe to import without forcing configuration changes.
The change is necessary for !1955 (closed) and !1952 (merged) in order to export test helpers from packages to other packages. !1952 (merged) allows us to export directly from packages without bringing in the standard library testing
package with its side effect of adding flags to the command line by relying on an interface rather than testing.T
.
The interface is in testhelpers
so we need to be able import it without side effects. Also, some of the utilities in testhelpers
can be helpful when authoring test utilities. This MR prevents the test configuration loading side effect of importing testhelpers
, so we can use its utilities in code that is not scoped as *_test.go
, thus allowing importing.