constabulary/gb

Packages ignored when testing

Opened this issue · 4 comments

My project looks like this:

➜  project.v2 git:(api/v2.0) ✗ tree ./src 
./src
├── api
│   ├── env.go
│   ├── handler.go
│   ├── handler_test.go
│   ├── main.go
│   ├── response.go
│   ├── response_test.go
│   └── router.go
[...]
├── passwd
│   ├── passwd.go
│   └── passwd_test.go

Even though there are tests in src/api/ gb seems to completely ignore them

➜  project.v2 git:(api/v2.0) ✗ gb test -tags project_api_test -v passwd
passwd
=== RUN   TestPasswdTestSuite
=== RUN   TestHashValidate
--- PASS: TestHashValidate (5.57s)
--- PASS: TestPasswdTestSuite (5.57s)
PASS
➜  project.v2 git:(api/v2.0) ✗ gb test -tags project_api_test -v passwd api
passwd
=== RUN   TestPasswdTestSuite
=== RUN   TestHashValidate
--- PASS: TestHashValidate (5.71s)
--- PASS: TestPasswdTestSuite (5.71s)
PASS
➜  project.v2 git:(api/v2.0) ✗ gb test -tags project_api_test -v api       
FATAL: command "test" failed: no test packages provided
➜  project.v2 git:(api/v2.0) ✗ gb test -tags project_api_test -v api passwd
passwd
=== RUN   TestPasswdTestSuite
=== RUN   TestHashValidate
--- PASS: TestHashValidate (5.55s)
--- PASS: TestPasswdTestSuite (5.55s)
PASS

I use gb d4ba64b

I found why.

There was a bad import in one of my go files which for some unknown reason was not reported by gb.

This import ultimately triggers this error which is not displayed.

Do you think you could at leat display the error ?

issue720.tar.gz

Just run run gb test api you should get an error message.

If you run gb test you will see that the api package is silently ignored because of a bad import in src/api/handler_test.go (the testhelpers package does not exists).

This bug is quite a nasty one.