Skip to content

Commit 44bcb96

Browse files
committed
go/packages: fix broken tests to handle changes to packagestest
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Michael Matloob <[email protected]>
1 parent a8576e2 commit 44bcb96

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

go/packages/packages_test.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,24 @@ func testLoadImportsGraph(t *testing.T, exporter packagestest.Exporter) {
9999
* golang.org/fake/c
100100
* golang.org/fake/e
101101
* golang.org/fake/subdir/d
102+
* golang.org/fake/subdir/d [golang.org/fake/subdir/d.test]
103+
* golang.org/fake/subdir/d.test
104+
* golang.org/fake/subdir/d_test [golang.org/fake/subdir/d.test]
105+
math/bits
102106
unsafe
103107
golang.org/fake/b -> errors
104108
golang.org/fake/b -> golang.org/fake/a
105109
golang.org/fake/c -> golang.org/fake/b
106110
golang.org/fake/c -> unsafe
107111
golang.org/fake/e -> golang.org/fake/b
108112
golang.org/fake/e -> golang.org/fake/c
113+
golang.org/fake/subdir/d [golang.org/fake/subdir/d.test] -> math/bits
114+
golang.org/fake/subdir/d.test -> golang.org/fake/subdir/d [golang.org/fake/subdir/d.test]
115+
golang.org/fake/subdir/d.test -> golang.org/fake/subdir/d_test [golang.org/fake/subdir/d.test]
116+
golang.org/fake/subdir/d.test -> os (pruned)
117+
golang.org/fake/subdir/d.test -> testing (pruned)
118+
golang.org/fake/subdir/d.test -> testing/internal/testdeps (pruned)
119+
golang.org/fake/subdir/d_test [golang.org/fake/subdir/d.test] -> golang.org/fake/subdir/d [golang.org/fake/subdir/d.test]
109120
`[1:]
110121

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

1271-
initial, err := packages.Load(exported.Config, "errors", "iamashamedtousethedisabledqueryname=errors")
1282+
cfg := *exported.Config
1283+
cfg.Tests = false
1284+
1285+
initial, err := packages.Load(&cfg, "errors", "iamashamedtousethedisabledqueryname=errors")
12721286
if err != nil {
12731287
t.Fatal(err)
12741288
}

0 commit comments

Comments
 (0)