Skip to content

Commit

Permalink
remove test for DetectExecutable(); add test for LookPath(GetExecutab…
Browse files Browse the repository at this point in the history
…le())
  • Loading branch information
denik committed Dec 19, 2024
1 parent 21a4cd1 commit 56785cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 0 additions & 5 deletions libs/python/pythontest/pythontest.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"testing"

"github.com/databricks/cli/internal/testutil"
"github.com/databricks/cli/libs/python"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -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))
}
8 changes: 8 additions & 0 deletions libs/python/pythontest/pythontest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ package pythontest

import (
"context"
"os/exec"
"path/filepath"
"testing"

"github.com/databricks/cli/libs/python"
"github.com/stretchr/testify/require"
)

Expand All @@ -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)
})
}
}
Expand Down

0 comments on commit 56785cf

Please sign in to comment.