fix Windows

This commit is contained in:
Denis Bilenko 2025-03-04 15:45:59 +01:00
parent 5c44533bb1
commit f31928af40
1 changed files with 11 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"testing"
"time"
@ -14,13 +15,22 @@ import (
"github.com/stretchr/testify/require"
)
var scriptsDir = getPythonScriptsDir()
func getPythonScriptsDir() string {
if runtime.GOOS == "windows" {
return "Scripts"
}
return "bin"
}
func verifyVersion(t *testing.T, tempDir, wheelPath string) {
// Extract the expected version from the wheel filename
wheelInfo, err := ParseWheelFilename(wheelPath)
require.NoError(t, err)
expectedVersion := wheelInfo.Version
pyExec := filepath.Join(tempDir, ".venv", "bin", "python") // Handle Windows paths appropriately
pyExec := filepath.Join(tempDir, ".venv", scriptsDir, "python")
cmdOut := captureOutput(t, tempDir, pyExec, "-c", "import myproj; myproj.print_version()")
actualVersion := strings.TrimSpace(cmdOut)
t.Logf("Verified installed version: %s", actualVersion)