From 8b91c207dbfb96509fac1b31c38ca8faf09ae015 Mon Sep 17 00:00:00 2001 From: Denis Bilenko Date: Mon, 3 Mar 2025 16:50:43 +0100 Subject: [PATCH] fix: Correct variable name in runCmd and update venv path in test --- libs/patchwheel/patchwheel_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libs/patchwheel/patchwheel_test.go b/libs/patchwheel/patchwheel_test.go index 711bfbbf9..75b39aeda 100644 --- a/libs/patchwheel/patchwheel_test.go +++ b/libs/patchwheel/patchwheel_test.go @@ -48,11 +48,12 @@ func writeProjectFiles(baseDir string, files map[string]string) error { } // runCmd runs a command in the given directory and returns its combined output. +// AI TODO: This should accept testing.T directly and fail the test if command fails func runCmd(dir, name string, args ...string) (string, error) { cmd := exec.Command(name, args...) cmd.Dir = dir var out bytes.Buffer - cmd.Stdout = &out + cm.Stdout = &out cmd.Stderr = &out err := cmd.Run() return out.String(), err @@ -73,12 +74,13 @@ func TestPatchWheel(t *testing.T) { } // Create a virtual environment using uv + // AI TODO: we re not us out here. So do not return out from runCmd; instead if there is stdout or stderr, log it with t.Error(). Note, in one case you need stdout below. So add separate helper captureOutpout to do that. if out, err := runCmd(tempDir, "uv", "venv", "--python", py, "venv"); err != nil { t.Fatalf("uv venv creation failed: %v, output: %s", err, out) } // Determine the pip and python paths inside the venv. - venvBin := filepath.Join(venvDir, "bin") + venvBin := filepath.Join(tempDir, "venv", "bin") pyExec := filepath.Join(venvBin, "python") pipExec := filepath.Join(venvBin, "pip")