From 56785cf555201229f87b13d3e25dc137ff2fb45c Mon Sep 17 00:00:00 2001 From: Denis Bilenko Date: Thu, 19 Dec 2024 14:29:24 +0100 Subject: [PATCH] remove test for DetectExecutable(); add test for LookPath(GetExecutable()) --- libs/python/pythontest/pythontest.go | 5 ----- libs/python/pythontest/pythontest_test.go | 8 ++++++++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libs/python/pythontest/pythontest.go b/libs/python/pythontest/pythontest.go index 8500c0f246..e43a1974b4 100644 --- a/libs/python/pythontest/pythontest.go +++ b/libs/python/pythontest/pythontest.go @@ -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)) } diff --git a/libs/python/pythontest/pythontest_test.go b/libs/python/pythontest/pythontest_test.go index d8eeca64b3..8af24d7189 100644 --- a/libs/python/pythontest/pythontest_test.go +++ b/libs/python/pythontest/pythontest_test.go @@ -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) }) } }