Skip to content

testing: Short() does not work in TestMain() #9825

@umisama

Description

@umisama

The testing.Short() have to report -test.short flag is set. But, it looks not working on TestMain(*testing.M).

You can see this behavior on this example.
https://gist.github.com/umisama/cebb1c8f9022e5402d21

Here is output on my environment.

$ go version
go version go1.4 linux/amd64
$ go test -short
false   on TestMain
true    on TestSomething
PASS
ok      _/home/umisama/testingshort  0.008s

In the example I expected to testing.Short() returns true for TestXxx() including TestMain(*testing.M), but it returns false on TestMain(*testing.M).

I'll create patch if this behavior is unexpected.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions