diff --git a/internal/testutil/env.go b/internal/testutil/env.go index 0ac3fbea83..10557c4e63 100644 --- a/internal/testutil/env.go +++ b/internal/testutil/env.go @@ -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) -} diff --git a/libs/python/pythontest/pythontest.go b/libs/python/pythontest/pythontest.go index 7e5e2eb280..8500c0f246 100644 --- a/libs/python/pythontest/pythontest.go +++ b/libs/python/pythontest/pythontest.go @@ -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)