Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Commit 398de52

Browse files
committed
create default cachedir for tests
1 parent 6460e2b commit 398de52

File tree

7 files changed

+19
-0
lines changed

7 files changed

+19
-0
lines changed

cmd/dep/ensure_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"go/build"
1111
"io/ioutil"
1212
"log"
13+
"path/filepath"
1314
"strings"
1415
"testing"
1516

@@ -200,6 +201,8 @@ func TestValidateUpdateArgs(t *testing.T) {
200201

201202
h.TempDir("src")
202203
pwd := h.Path(".")
204+
// Create the directory for default cachedir location.
205+
h.TempDir(filepath.Join("pkg", "dep"))
203206

204207
stderrOutput := &bytes.Buffer{}
205208
errLogger := log.New(stderrOutput, "", 0)

cmd/dep/gopath_scanner_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package main
77
import (
88
"io/ioutil"
99
"log"
10+
"path/filepath"
1011
"reflect"
1112
"testing"
1213

@@ -22,6 +23,8 @@ const testProject2 string = "github.com/sdboyer/deptestdos"
2223
func NewTestContext(h *test.Helper) *dep.Ctx {
2324
h.TempDir("src")
2425
pwd := h.Path(".")
26+
// Create the directory for default cachedir location.
27+
h.TempDir(filepath.Join("pkg", "dep"))
2528
discardLogger := log.New(ioutil.Discard, "", 0)
2629

2730
return &dep.Ctx{

cmd/dep/status_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"bytes"
99
"io/ioutil"
1010
"log"
11+
"path/filepath"
1112
"reflect"
1213
"testing"
1314
"text/tabwriter"
@@ -384,6 +385,8 @@ func TestCollectConstraints(t *testing.T) {
384385

385386
h.TempDir("src")
386387
pwd := h.Path(".")
388+
// Create the directory for default cachedir location.
389+
h.TempDir(filepath.Join("pkg", "dep"))
387390
discardLogger := log.New(ioutil.Discard, "", 0)
388391

389392
ctx := &dep.Ctx{

internal/importers/importertest/testcase.go

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"bytes"
99
"io/ioutil"
1010
"log"
11+
"path/filepath"
1112
"sort"
1213
"strings"
1314
"testing"
@@ -35,6 +36,8 @@ type TestCase struct {
3536
func NewTestContext(h *test.Helper) *dep.Ctx {
3637
h.TempDir("src")
3738
pwd := h.Path(".")
39+
// Create the directory for default cachedir location.
40+
h.TempDir(filepath.Join("pkg", "dep"))
3841
discardLogger := log.New(ioutil.Discard, "", 0)
3942

4043
return &dep.Ctx{

internal/test/integration/testproj.go

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ func NewTestProject(t *testing.T, initPath, wd string, run RunFunc) *TestProject
5353
new.CopyTree(initPath)
5454

5555
new.Setenv("GOPATH", new.tempdir)
56+
// Create the directory for default cachedir location.
57+
new.TempDir("pkg", "dep")
5658

5759
return new
5860
}

manifest_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"fmt"
1111
"io/ioutil"
1212
"log"
13+
"path/filepath"
1314
"reflect"
1415
"strings"
1516
"testing"
@@ -562,6 +563,8 @@ func TestValidateProjectRoots(t *testing.T) {
562563

563564
h.TempDir("src")
564565
pwd := h.Path(".")
566+
// Create the directory for default cachedir location.
567+
h.TempDir(filepath.Join("pkg", "dep"))
565568

566569
// Capture the stderr to verify the warnings
567570
stderrOutput := &bytes.Buffer{}

test_project_context_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ func NewTestProjectContext(h *test.Helper, projectName string) *TestProjectConte
3030
// Create the test project directory
3131
pc.tempProjectDir = filepath.Join("src", projectName)
3232
h.TempDir(pc.tempProjectDir)
33+
// Create the directory for default cachedir location.
34+
h.TempDir(filepath.Join(pc.tempDir, "pkg", "dep"))
3335
pc.tempDir = h.Path(".")
3436
pc.Project = &Project{AbsRoot: filepath.Join(pc.tempDir, pc.tempProjectDir)}
3537
h.Cd(pc.Project.AbsRoot)

0 commit comments

Comments
 (0)