mirror of https://github.com/databricks/cli.git
remove test for DetectExecutable(); add test for LookPath(GetExecutable())
This commit is contained in:
parent
21a4cd1128
commit
56785cf555
|
@ -12,7 +12,6 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/databricks/cli/internal/testutil"
|
||||
"github.com/databricks/cli/libs/python"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
@ -108,8 +107,4 @@ func RequireActivatedPythonEnv(t *testing.T, ctx context.Context, opts *VenvOpts
|
|||
|
||||
newPath := fmt.Sprintf("%s%c%s", opts.BinPath, os.PathListSeparator, os.Getenv("PATH"))
|
||||
t.Setenv("PATH", newPath)
|
||||
|
||||
pythonExe, err := python.DetectExecutable(ctx)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, filepath.Dir(pythonExe), filepath.Dir(opts.PythonExe))
|
||||
}
|
||||
|
|
|
@ -2,8 +2,11 @@ package pythontest
|
|||
|
||||
import (
|
||||
"context"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/databricks/cli/libs/python"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
@ -17,6 +20,11 @@ func TestVenvSuccess(t *testing.T) {
|
|||
require.DirExists(t, opts.EnvPath)
|
||||
require.DirExists(t, opts.BinPath)
|
||||
require.FileExists(t, opts.PythonExe)
|
||||
|
||||
pythonExe, err := exec.LookPath(python.GetExecutable())
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, filepath.Dir(pythonExe), filepath.Dir(opts.PythonExe))
|
||||
require.FileExists(t, pythonExe)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue