Skip to content

Commit

Permalink
go/packages: fix broken tests to handle changes to packagestest
Browse files Browse the repository at this point in the history
golang.org/cl/161317 set Tests to true in the packagestest go/packages
Config. Handle this in the go/packages tests.

Fixes #30115

Change-Id: I6b4c0ca3dc2d73855239f3e7122e29da6ce81657
Reviewed-on: https://go-review.googlesource.com/c/161457
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
  • Loading branch information
stamblerre committed Feb 6, 2019
1 parent a8576e2 commit 44bcb96
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion go/packages/packages_test.go
Expand Up @@ -99,13 +99,24 @@ func testLoadImportsGraph(t *testing.T, exporter packagestest.Exporter) {
* golang.org/fake/c
* golang.org/fake/e
* golang.org/fake/subdir/d
* golang.org/fake/subdir/d [golang.org/fake/subdir/d.test]
* golang.org/fake/subdir/d.test
* golang.org/fake/subdir/d_test [golang.org/fake/subdir/d.test]
math/bits
unsafe
golang.org/fake/b -> errors
golang.org/fake/b -> golang.org/fake/a
golang.org/fake/c -> golang.org/fake/b
golang.org/fake/c -> unsafe
golang.org/fake/e -> golang.org/fake/b
golang.org/fake/e -> golang.org/fake/c
golang.org/fake/subdir/d [golang.org/fake/subdir/d.test] -> math/bits
golang.org/fake/subdir/d.test -> golang.org/fake/subdir/d [golang.org/fake/subdir/d.test]
golang.org/fake/subdir/d.test -> golang.org/fake/subdir/d_test [golang.org/fake/subdir/d.test]
golang.org/fake/subdir/d.test -> os (pruned)
golang.org/fake/subdir/d.test -> testing (pruned)
golang.org/fake/subdir/d.test -> testing/internal/testdeps (pruned)
golang.org/fake/subdir/d_test [golang.org/fake/subdir/d.test] -> golang.org/fake/subdir/d [golang.org/fake/subdir/d.test]
`[1:]

if graph != wantGraph {
Expand Down Expand Up @@ -1268,7 +1279,10 @@ func testRedundantQueries(t *testing.T, exporter packagestest.Exporter) {
}}})
defer exported.Cleanup()

initial, err := packages.Load(exported.Config, "errors", "iamashamedtousethedisabledqueryname=errors")
cfg := *exported.Config
cfg.Tests = false

initial, err := packages.Load(&cfg, "errors", "iamashamedtousethedisabledqueryname=errors")
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit 44bcb96

Please sign in to comment.