From 1357f4a78b5ecf386e10270a995fb3f225d394ec Mon Sep 17 00:00:00 2001 From: Denis Bilenko Date: Thu, 19 Dec 2024 15:25:45 +0100 Subject: [PATCH] fix handling of Dir option; use TempDir in test --- libs/python/pythontest/pythontest.go | 3 --- libs/python/pythontest/pythontest_test.go | 6 +++++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libs/python/pythontest/pythontest.go b/libs/python/pythontest/pythontest.go index e43a1974b..9a2dec0ee 100644 --- a/libs/python/pythontest/pythontest.go +++ b/libs/python/pythontest/pythontest.go @@ -42,9 +42,6 @@ func CreatePythonEnv(opts *VenvOpts) error { if opts.Name == "" { opts.Name = testutil.RandomName("test-venv-") } - if opts.Dir != "" { - opts.Dir = "." - } cmd := exec.Command("uv", "venv", opts.Name, "--python", opts.PythonVersion, "--seed", "-q") cmd.Stdout = os.Stdout diff --git a/libs/python/pythontest/pythontest_test.go b/libs/python/pythontest/pythontest_test.go index 8af24d718..3161092d3 100644 --- a/libs/python/pythontest/pythontest_test.go +++ b/libs/python/pythontest/pythontest_test.go @@ -15,7 +15,11 @@ func TestVenvSuccess(t *testing.T) { for _, pythonVersion := range []string{"3.11", "3.12"} { t.Run(pythonVersion, func(t *testing.T) { ctx := context.Background() - opts := VenvOpts{PythonVersion: pythonVersion} + dir := t.TempDir() + opts := VenvOpts{ + PythonVersion: pythonVersion, + Dir: dir, + } RequireActivatedPythonEnv(t, ctx, &opts) require.DirExists(t, opts.EnvPath) require.DirExists(t, opts.BinPath)