"warning no tests to run"

roger peppe roger.peppe at canonical.com
Thu Aug 29 14:45:46 UTC 2013


On 29 August 2013 11:09, John Arbash Meinel <john at arbash-meinel.com> wrote:
> Namely, "go test -gocheck.v ./..." doesn't *actually* run the tests in
> any subdirectories.
>
> The specific problem is how the arguments get evaluated, but we don't
> have any workarounds for it that I know of. (You just don't pass
> - -gocheck.v to ./... is the only workaround I have.)

It's not a bug, it's a feature! (well, it's documented anyway).
>From "go help test":

"If the test binary needs any other flags, they should be presented after the
package names. The go tool treats as a flag the first argument that begins with
a minus sign that it does not recognize itself; that argument and all subsequent
arguments are passed as arguments to the test binary."

That's because in general it's not possible to distinguish test
binary arguments from test flags - there's no way that
go test can know that --gocheck.v doesn't take an argument,
for example. This is the usual problem with command-line flag syntax - it's
a context-sensitive grammar.

But it does show the workaround:

    go test ./... -gocheck.v

... not that the -gocheck.v flag helps in this case, because
go test only prints test output for failing packages by default.

I think:

    go test -v ./... -gocheck.v

might be what's needed here (assuming you really want to see all that
output - personally I think that's more verbose than generally needed,
and is likely to hide the output from any failing tests).



More information about the Juju-dev mailing list