File tree 3 files changed +4
-27
lines changed
3 files changed +4
-27
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ package fs
2
2
3
3
import (
4
4
"context"
5
- "os"
6
5
"testing"
7
6
8
7
"github.com/hashicorp/go-version"
@@ -25,11 +24,7 @@ func TestExactVersion(t *testing.T) {
25
24
26
25
// TODO: mock out command execution?
27
26
28
- originalPath := os .Getenv ("PATH" )
29
- os .Setenv ("PATH" , "" )
30
- t .Cleanup (func () {
31
- os .Setenv ("PATH" , originalPath )
32
- })
27
+ t .Setenv ("PATH" , "" )
33
28
34
29
ev := & ExactVersion {
35
30
Product : product .Terraform ,
Original file line number Diff line number Diff line change @@ -17,14 +17,8 @@ import (
17
17
func TestAnyVersion_notExecutable (t * testing.T ) {
18
18
testutil .EndToEndTest (t )
19
19
20
- originalPath := os .Getenv ("PATH" )
21
- os .Setenv ("PATH" , "" )
22
- t .Cleanup (func () {
23
- os .Setenv ("PATH" , originalPath )
24
- })
25
-
26
20
dirPath , fileName := testutil .CreateTempFile (t , "" )
27
- os .Setenv ("PATH" , dirPath )
21
+ t .Setenv ("PATH" , dirPath )
28
22
29
23
av := & AnyVersion {
30
24
Product : & product.Product {
@@ -41,14 +35,8 @@ func TestAnyVersion_notExecutable(t *testing.T) {
41
35
func TestAnyVersion_executable (t * testing.T ) {
42
36
testutil .EndToEndTest (t )
43
37
44
- originalPath := os .Getenv ("PATH" )
45
- os .Setenv ("PATH" , "" )
46
- t .Cleanup (func () {
47
- os .Setenv ("PATH" , originalPath )
48
- })
49
-
50
38
dirPath , fileName := testutil .CreateTempFile (t , "" )
51
- os .Setenv ("PATH" , dirPath )
39
+ t .Setenv ("PATH" , dirPath )
52
40
53
41
fullPath := filepath .Join (dirPath , fileName )
54
42
err := os .Chmod (fullPath , 0700 )
Original file line number Diff line number Diff line change @@ -14,14 +14,8 @@ import (
14
14
func TestAnyVersion_executable (t * testing.T ) {
15
15
testutil .EndToEndTest (t )
16
16
17
- originalPath := os .Getenv ("path" )
18
- os .Setenv ("path" , "" )
19
- t .Cleanup (func () {
20
- os .Setenv ("path" , originalPath )
21
- })
22
-
23
17
dirPath , fileName := testutil .CreateTempFile (t , "" )
24
- os .Setenv ("path" , dirPath )
18
+ t .Setenv ("path" , dirPath )
25
19
26
20
av := & AnyVersion {
27
21
Product : & product.Product {
You can’t perform that action at this time.
0 commit comments