Packages ignored when testing
Opened this issue · 4 comments
jeromer commented
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 commented
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 commented
Sadly no, because no go error also happens when there are no go files at
all, or no go files that match the current build tags. It's an error that
is not an error.
Could you please include a sample project that demonstrates the issue and
I'll try to work something out.
…On Fri, 31 Mar 2017, 03:33 Jérôme Renard ***@***.***> wrote:
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
<https://github.com/constabulary/gb/blob/master/cmd/gb/build.go#L142>
which is not displayed.
Do you think you could at leat display the error ?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#702 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAcAwfbXumRkqWO2G7Le3PD3RY-G4Twks5rq9lvgaJpZM4MukPT>
.
jeromer commented
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 commented
This is what I get
deadwood(~/devel/issue720) % gb build
FATAL: command "build" failed: failed to resolve import path
"testhelpers/db": import "github.com/jeromer/pgx": not found: stat
/home/dfc/devel/issue720/src/github.com/jeromer/pgx: no such file or
directory
…On Fri, Mar 31, 2017 at 8:31 AM, Jérôme Renard ***@***.***> wrote:
issue720.tar.gz
<https://github.com/constabulary/gb/files/883841/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.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#702 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAcA_vAQdG-Odkg9dXdcmptPkCYvtvTks5rrB8vgaJpZM4MukPT>
.