Open echlebek opened 6 years ago
Perhaps it was a mistake to add a -test.list
option to test binaries. Now that we've done that, it seems clearly desirable for go test -list
and go test -c; ./pkg.test -test.list
do the same thing.
Same issue was seen with below code as well...when asked to list, BeforeSuite() and AfterSuite() methods too get called
func TestMain(m *testing.M) {
BeforeSuite()
exitCode := m.Run()
AfterSuite()
os.Exit(exitCode)
}
This problem has existed for quite some time: https://github.com/golang/go/issues/17209
But yes, it would be super useful to have tests listed (not executed) even if the subtests/table tests cannot be found.
This is a small quibble, but caused me some surprise recently.
What version of Go are you using (
go version
)?go version go1.10.2 linux/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?
foo_test.go
What did you expect to see?
What did you see instead?
In https://github.com/golang/go/issues/17209, Nemith proposes that
go test -list
would list the tests, but no tests would be run or any other operation.I think that since it can be statically determined what the tests in a package are, the -list functionality should not depend on executing the test binary.