Skip to content

Commit

Permalink
rm InsertPathEntry; use os.PathListSeparator
Browse files Browse the repository at this point in the history
  • Loading branch information
denik committed Dec 19, 2024
1 parent dcfeeac commit 5b4c762
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
22 changes: 0 additions & 22 deletions internal/testutil/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,25 +61,3 @@ func Chdir(t TestingT, dir string) string {

return wd
}

func InsertPathEntry(t TestingT, path string) {
var separator string
if runtime.GOOS == "windows" {
separator = ";"
} else {
separator = ":"
}

t.Setenv("PATH", path+separator+os.Getenv("PATH"))
}

func InsertVirtualenvInPath(t TestingT, venvPath string) {
if runtime.GOOS == "windows" {
// https://github.com/pypa/virtualenv/commit/993ba1316a83b760370f5a3872b3f5ef4dd904c1
venvPath = filepath.Join(venvPath, "Scripts")
} else {
venvPath = filepath.Join(venvPath, "bin")
}

InsertPathEntry(t, venvPath)
}
3 changes: 2 additions & 1 deletion libs/python/pythontest/pythontest.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ func RequireActivatedPythonEnv(t *testing.T, ctx context.Context, opts *VenvOpts
require.NoError(t, err)
require.DirExists(t, opts.BinPath)

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

pythonExe, err := python.DetectExecutable(ctx)
require.NoError(t, err)
Expand Down

0 comments on commit 5b4c762

Please sign in to comment.