mirror of https://github.com/databricks/cli.git
fix Windows
This commit is contained in:
parent
5c44533bb1
commit
f31928af40
|
@ -6,6 +6,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
@ -14,13 +15,22 @@ import (
|
||||||
"github.com/stretchr/testify/require"
|
"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) {
|
func verifyVersion(t *testing.T, tempDir, wheelPath string) {
|
||||||
// Extract the expected version from the wheel filename
|
// Extract the expected version from the wheel filename
|
||||||
wheelInfo, err := ParseWheelFilename(wheelPath)
|
wheelInfo, err := ParseWheelFilename(wheelPath)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
expectedVersion := wheelInfo.Version
|
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()")
|
cmdOut := captureOutput(t, tempDir, pyExec, "-c", "import myproj; myproj.print_version()")
|
||||||
actualVersion := strings.TrimSpace(cmdOut)
|
actualVersion := strings.TrimSpace(cmdOut)
|
||||||
t.Logf("Verified installed version: %s", actualVersion)
|
t.Logf("Verified installed version: %s", actualVersion)
|
||||||
|
|
Loading…
Reference in New Issue