Skip to content

Commit

Permalink
test/thirdparty: revert changes to packages_test
Browse files Browse the repository at this point in the history
  • Loading branch information
mmcloughlin committed Apr 19, 2021
1 parent a8137d8 commit 1c443fe
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions tests/thirdparty/packages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ type PackageTest struct {
Latest bool // use latest version of the package

repopath string // path the repo is cloned to
cwd string // working directory to execute commands in
}

// Run the test.
Expand All @@ -80,7 +79,6 @@ func (t *PackageTest) checkout() {
dst := filepath.Join(t.WorkDir, t.Name())
t.git("clone", "--quiet", t.CloneURL(), dst)
t.repopath = dst
t.cd(t.repopath)

// Checkout specific version.
if t.Latest {
Expand All @@ -105,7 +103,6 @@ func (t *PackageTest) modinit() {

// replaceavo points all avo dependencies to the local version.
func (t *PackageTest) replaceavo() {

// Determine the path to avo.
_, self, _, ok := runtime.Caller(1)
if !ok {
Expand All @@ -118,22 +115,15 @@ func (t *PackageTest) replaceavo() {
if err != nil {
return err
}
dir, base := filepath.Split(path)
if base != "go.mod" {
if filepath.Base(path) != "go.mod" {
return nil
}
t.cd(dir)
t.gotool("mod", "tidy")
t.gotool("get", "github.com/mmcloughlin/avo")
t.gotool("mod", "edit", "-replace=github.com/mmcloughlin/avo="+avodir)
t.gotool("mod", "download")
t.gotool("mod", "edit", "-replace=github.com/mmcloughlin/avo="+avodir, path)
return nil
})
if err != nil {
t.Fatal(err)
}

t.cd(t.repopath)
}

// generate runs generate commands.
Expand Down Expand Up @@ -166,11 +156,6 @@ func (t *PackageTest) git(arg ...string) {
// gotool runs a go command.
func (t *PackageTest) gotool(arg ...string) {
cmd := exec.Command(test.GoTool(), arg...)
cmd.Dir = t.cwd
cmd.Dir = t.repopath
test.ExecCommand(t.T, cmd)
}

// cd sets the working directory.
func (t *PackageTest) cd(dir string) {
t.cwd = dir
}

0 comments on commit 1c443fe

Please sign in to comment.