Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cli/azd/pkg/tools/language/python_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"context"
"errors"
"fmt"
"log"
"os"
"path/filepath"
"runtime"
Expand Down Expand Up @@ -246,6 +247,11 @@ func (e *pythonExecutor) installDeps(
err,
)
}
default:
log.Printf(
"unsupported dependency file %q - skipping install",
depFile,
)
}
Comment thread
wbreza marked this conversation as resolved.
return nil
}
Expand Down
36 changes: 36 additions & 0 deletions cli/azd/pkg/tools/language/python_executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
package language

import (
"bytes"
"context"
"errors"
"log"
"os"
"path/filepath"
"runtime"
Expand Down Expand Up @@ -263,6 +265,40 @@ func TestPythonPrepare_VenvAlreadyExists(t *testing.T) {
assert.NotEmpty(t, e.venvPath)
}

func TestPythonInstallDeps_UnrecognizedFile(t *testing.T) {
cli := &mockPythonTools{}
e := newPythonExecutorInternal(
&mockCommandRunner{}, cli,
)

// Capture log output to verify the default-case message.
var buf bytes.Buffer
log.SetOutput(&buf)
defer log.SetOutput(os.Stderr)

err := e.installDeps(
t.Context(), t.TempDir(),
"some_env", "unknown.cfg", nil,
)

require.NoError(t, err,
"unrecognized dep file should not return an error",
)
assert.False(t, cli.installReqCalled,
"should not call InstallRequirements",
)
assert.False(t, cli.installProjCalled,
"should not call InstallProject",
)
assert.Contains(t, buf.String(),
"unsupported dependency file",
"should log a skip message for unrecognized files",
)
assert.Contains(t, buf.String(), "unknown.cfg",
"log message should include the file name",
)
}
Comment thread
wbreza marked this conversation as resolved.

// ---------------------------------------------------------------------------
// Execute tests
// ---------------------------------------------------------------------------
Expand Down
Loading