-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package testutil | ||
|
||
import ( | ||
"bytes" | ||
"os" | ||
"os/exec" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func RunCommand(t TestingT, name string, args ...string) { | ||
cmd := exec.Command(name, args...) | ||
cmd.Stdout = os.Stdout | ||
cmd.Stderr = os.Stderr | ||
require.NoError(t, cmd.Run()) | ||
} | ||
|
||
func CaptureCommandOutput(t TestingT, name string, args ...string) string { | ||
cmd := exec.Command(name, args...) | ||
var stdout bytes.Buffer | ||
cmd.Stdout = &stdout | ||
cmd.Stderr = os.Stderr | ||
err := cmd.Run() | ||
require.NoError(t, err) | ||
return stdout.String() | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package pythontest | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
) | ||
|
||
func TestVenv(t *testing.T) { | ||
// Test at least two version to ensure we capture a case where venv version does not match system one | ||
for _, pythonVersion := range []string{"3.11", "3.12"} { | ||
t.Run(pythonVersion, func(t *testing.T) { | ||
ctx := context.Background() | ||
RequirePythonVENV(t, ctx, pythonVersion, true) | ||
Check failure on line 13 in libs/python/pythontest/pythontest_test.go GitHub Actions / tests (macos-latest)
Check failure on line 13 in libs/python/pythontest/pythontest_test.go GitHub Actions / tests (macos-latest)
Check failure on line 13 in libs/python/pythontest/pythontest_test.go GitHub Actions / lint
Check failure on line 13 in libs/python/pythontest/pythontest_test.go GitHub Actions / tests (ubuntu-latest)
Check failure on line 13 in libs/python/pythontest/pythontest_test.go GitHub Actions / tests (ubuntu-latest)
Check failure on line 13 in libs/python/pythontest/pythontest_test.go GitHub Actions / tests (windows-latest)
|
||
}) | ||
} | ||
} |