mirror of https://github.com/databricks/cli.git
fix handling of Dir option; use TempDir in test
This commit is contained in:
parent
56785cf555
commit
1357f4a78b
|
@ -42,9 +42,6 @@ func CreatePythonEnv(opts *VenvOpts) error {
|
||||||
if opts.Name == "" {
|
if opts.Name == "" {
|
||||||
opts.Name = testutil.RandomName("test-venv-")
|
opts.Name = testutil.RandomName("test-venv-")
|
||||||
}
|
}
|
||||||
if opts.Dir != "" {
|
|
||||||
opts.Dir = "."
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd := exec.Command("uv", "venv", opts.Name, "--python", opts.PythonVersion, "--seed", "-q")
|
cmd := exec.Command("uv", "venv", opts.Name, "--python", opts.PythonVersion, "--seed", "-q")
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
|
|
|
@ -15,7 +15,11 @@ func TestVenvSuccess(t *testing.T) {
|
||||||
for _, pythonVersion := range []string{"3.11", "3.12"} {
|
for _, pythonVersion := range []string{"3.11", "3.12"} {
|
||||||
t.Run(pythonVersion, func(t *testing.T) {
|
t.Run(pythonVersion, func(t *testing.T) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
opts := VenvOpts{PythonVersion: pythonVersion}
|
dir := t.TempDir()
|
||||||
|
opts := VenvOpts{
|
||||||
|
PythonVersion: pythonVersion,
|
||||||
|
Dir: dir,
|
||||||
|
}
|
||||||
RequireActivatedPythonEnv(t, ctx, &opts)
|
RequireActivatedPythonEnv(t, ctx, &opts)
|
||||||
require.DirExists(t, opts.EnvPath)
|
require.DirExists(t, opts.EnvPath)
|
||||||
require.DirExists(t, opts.BinPath)
|
require.DirExists(t, opts.BinPath)
|
||||||
|
|
Loading…
Reference in New Issue