databricks-cli/libs/python/interpreters_win_test.go

29 lines
576 B
Go
Raw Normal View History

//go:build windows
package python
import (
"context"
"testing"
"github.com/stretchr/testify/assert"
)
func TestAtLeastOnePythonInstalled(t *testing.T) {
ctx := context.Background()
all, err := DetectInterpreters(ctx)
assert.NoError(t, err)
a := all.Latest()
t.Logf("latest is: %s", a)
assert.True(t, len(all) > 0)
}
func TestNoInterpretersFound(t *testing.T) {
t.Setenv("PATH", t.TempDir())
ctx := context.Background()
_, err := DetectInterpreters(ctx)
assert.ErrorIs(t, err, ErrNoPythonInterpreters)
assert.ErrorContains(t, err, "python.org/downloads")
}