2024-05-06 18:29:44 +00:00
|
|
|
package plugin
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2024-05-06 19:03:08 +00:00
|
|
|
"github.com/stretchr/testify/assert"
|
2024-05-06 18:29:44 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestPipInstall(t *testing.T) {
|
|
|
|
tests := []struct {
|
|
|
|
name string
|
|
|
|
requirements string
|
|
|
|
want []string
|
|
|
|
}{
|
|
|
|
{
|
|
|
|
name: "with valid requirements file",
|
|
|
|
requirements: "requirements.txt",
|
|
|
|
want: []string{pipBin, "install", "--upgrade", "--requirement", "requirements.txt"},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, tt := range tests {
|
|
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
|
|
cmd := PipInstall(tt.requirements)
|
2024-05-06 19:03:08 +00:00
|
|
|
assert.Equal(t, tt.want, cmd.Cmd.Args)
|
2024-05-06 18:29:44 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|