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

Commit

Permalink
create default cachedir for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sudo-suhas committed Dec 2, 2017
1 parent 71e2117 commit a4cbceb
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/dep/ensure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"go/build"
"io/ioutil"
"log"
"path/filepath"
"strings"
"testing"

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

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

stderrOutput := &bytes.Buffer{}
errLogger := log.New(stderrOutput, "", 0)
Expand Down
3 changes: 3 additions & 0 deletions cmd/dep/gopath_scanner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package main
import (
"io/ioutil"
"log"
"path/filepath"
"reflect"
"testing"

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

return &dep.Ctx{
Expand Down
3 changes: 3 additions & 0 deletions cmd/dep/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"bytes"
"io/ioutil"
"log"
"path/filepath"
"reflect"
"testing"
"text/tabwriter"
Expand Down Expand Up @@ -384,6 +385,8 @@ func TestCollectConstraints(t *testing.T) {

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

ctx := &dep.Ctx{
Expand Down
3 changes: 3 additions & 0 deletions internal/importers/importertest/testcase.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"bytes"
"io/ioutil"
"log"
"path/filepath"
"sort"
"strings"
"testing"
Expand Down Expand Up @@ -35,6 +36,8 @@ type TestCase struct {
func NewTestContext(h *test.Helper) *dep.Ctx {
h.TempDir("src")
pwd := h.Path(".")
// Create the directory for default cachedir location.
h.TempDir(filepath.Join("pkg", "dep"))
discardLogger := log.New(ioutil.Discard, "", 0)

return &dep.Ctx{
Expand Down
2 changes: 2 additions & 0 deletions internal/test/integration/testproj.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ func NewTestProject(t *testing.T, initPath, wd string, run RunFunc) *TestProject
new.CopyTree(initPath)

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

return new
}
Expand Down
3 changes: 3 additions & 0 deletions manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"fmt"
"io/ioutil"
"log"
"path/filepath"
"reflect"
"strings"
"testing"
Expand Down Expand Up @@ -562,6 +563,8 @@ func TestValidateProjectRoots(t *testing.T) {

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

// Capture the stderr to verify the warnings
stderrOutput := &bytes.Buffer{}
Expand Down
2 changes: 2 additions & 0 deletions test_project_context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ func NewTestProjectContext(h *test.Helper, projectName string) *TestProjectConte
// Create the test project directory
pc.tempProjectDir = filepath.Join("src", projectName)
h.TempDir(pc.tempProjectDir)
// Create the directory for default cachedir location.
h.TempDir(filepath.Join(pc.tempDir, "pkg", "dep"))
pc.tempDir = h.Path(".")
pc.Project = &Project{AbsRoot: filepath.Join(pc.tempDir, pc.tempProjectDir)}
h.Cd(pc.Project.AbsRoot)
Expand Down

0 comments on commit a4cbceb

Please sign in to comment.