Skip to content

Commit 5b4c762

Browse files
committed
rm InsertPathEntry; use os.PathListSeparator
1 parent dcfeeac commit 5b4c762

File tree

2 files changed

+2
-23
lines changed

2 files changed

+2
-23
lines changed

internal/testutil/env.go

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -61,25 +61,3 @@ func Chdir(t TestingT, dir string) string {
6161

6262
return wd
6363
}
64-
65-
func InsertPathEntry(t TestingT, path string) {
66-
var separator string
67-
if runtime.GOOS == "windows" {
68-
separator = ";"
69-
} else {
70-
separator = ":"
71-
}
72-
73-
t.Setenv("PATH", path+separator+os.Getenv("PATH"))
74-
}
75-
76-
func InsertVirtualenvInPath(t TestingT, venvPath string) {
77-
if runtime.GOOS == "windows" {
78-
// https://github.com/pypa/virtualenv/commit/993ba1316a83b760370f5a3872b3f5ef4dd904c1
79-
venvPath = filepath.Join(venvPath, "Scripts")
80-
} else {
81-
venvPath = filepath.Join(venvPath, "bin")
82-
}
83-
84-
InsertPathEntry(t, venvPath)
85-
}

libs/python/pythontest/pythontest.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ func RequireActivatedPythonEnv(t *testing.T, ctx context.Context, opts *VenvOpts
106106
require.NoError(t, err)
107107
require.DirExists(t, opts.BinPath)
108108

109-
testutil.InsertPathEntry(t, opts.BinPath)
109+
newPath := fmt.Sprintf("%s%c%s", opts.BinPath, os.PathListSeparator, os.Getenv("PATH"))
110+
t.Setenv("PATH", newPath)
110111

111112
pythonExe, err := python.DetectExecutable(ctx)
112113
require.NoError(t, err)

0 commit comments

Comments
 (0)