New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/go: go test should not clutter output with "no test files" #20223
Comments
I believe the previous behavior was also to print the package name and a question mark. The [no test files] is to distinguish I think between cases where there were tests, but they were all skipped, and when there are no tests. |
As I understand, the purpose of Go packages that have no test files can still be tested for build errors. So when you see
You said you did If you want to test only a single package named For example:
You can even get creative with patterns and do something like But the point is you shouldn't run |
@shurcooL thanks for the response! I don't look at Also, I tried
Any ideas? I would respectfully disagree with your statement "But the point is you shouldn't run go test on packages that you don't want to test" and revise it to be "But the point is go test shouldn't try to test any packages that don't contain tests". Thoughts? Thanks! |
That means you don't have any packages that match that import path pattern. It looks like they're private repos, so I can't help you without knowing what they are. You can read more about the import path patterns at https://golang.org/cmd/go/#hdr-Description_of_package_lists. As an example, you can also try
Fair enough. I guess it's a matter of opinion/preference/what one is used to. I can see both ways can make sense, in their own way. However,
Unlike |
Thanks again @shurcooL ! Actually, my mistake, my tests are in a subdir/subpackage called I still would like to see this behavior as at least an option for Thoughts? |
Glad to hear that! 👍
My personal preference is to set a really high bar for inclusion of flags/options, and aim to have as few as possible. Existing ones are rarely removed. But each one adds some overhead, increasing the number of options people need to be aware of, diluting the value offered by other flags. In an ideal world, only the absolutely critical and useful flags would exist. This is not a flag I'd want added, since I suspect its value offered would not warrant the cost of its inclusion. It's easy to filter out unwanted output, either by not including it in the |
Thanks @shurcooL . But along the lines of your dilution argument, I'd argue that |
I consider the "spam" useful. Particularly when build tags are used it's easy to miss that for some combination of build tags there are effectively no tests. When that is not intended, the "warning" by go test reveals the bug. |
@cznic thanks! But how is it a "bug" to not have tests in a given package? I personally consider it kind of sloppy and hard to organize packages with tests directly in the package and prefer to put tests in a sub package, as in the tests for package In that case, I know that there are no tests in package But I respect that others feel differently, and that's OK! :-) |
This is working as intended, as others have noted. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.8 darwin/amd64
What operating system and processor architecture are you using (
go env
)?amd64, darwin
What did you do?
bash> cd ~/go/src/myproject
bash> go test github.com/presencelabs/...
...
go test outputs some useful test results like
ok github.com/presencelabs/ourapp/apiserver/apiservercore/rendermodels/tests 0.024s
...
go test outputs a lot of unuseful test results like
? github.com/presencelabs/ourapp/apiserver/apiservercore/service [no test files]
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
What did you expect to see?
I only want to see output about which tests ran and which passed and which failed. I do NOT care about packages or dirs that have no tests in them.
What did you see instead?
I don't care about the directories/packages with no test files. I know that they don't have any test files. They are not meant to have any test files since we put our test files in subdirs called
test
. Telling me repeatedly that these dirs have no test files clutters the test output and obscures the important information like which tests actually ran and which passed and which failed.Telling me that a dir has no test files should be left to the coverage tool/option. Either
go test
should NOT log dirs/packages that have no tests by default, or there should be an option to skip that logging as in--no-warn-no-tests
or similar.I'm happy to help with a PR if there's interest. But right now, all this clutter about no tests is really reducing our productivity and we need to run tests like
clear; go test github.com/presencelabs/... | grep -v "no test files"
which is cumbersome.By the way, we love go! Thanks for your hard work on it. :-) I'm not meaning to whine, I just want to make go even better.
The text was updated successfully, but these errors were encountered: