Skip to content
This repository has been archived by the owner on Mar 6, 2020. It is now read-only.

Packages ignored when testing #702

Open
jeromer opened this issue Mar 30, 2017 · 4 comments
Open

Packages ignored when testing #702

jeromer opened this issue Mar 30, 2017 · 4 comments

Comments

@jeromer
Copy link

jeromer commented Mar 30, 2017

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

@jeromer
Copy link
Author

jeromer commented Mar 30, 2017

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 ?

@davecheney
Copy link
Contributor

davecheney commented Mar 30, 2017 via email

@jeromer
Copy link
Author

jeromer commented Mar 30, 2017

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.

@davecheney
Copy link
Contributor

davecheney commented Mar 30, 2017 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants