Skip to content

Commit

Permalink
WIP: fix windows pip resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
filip-debricked committed Apr 2, 2024
1 parent b9bd193 commit d4b6704
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
13 changes: 13 additions & 0 deletions internal/resolution/pm/pip/job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,19 @@ func TestParsePipList(t *testing.T) {
assert.False(t, j.Errors().HasError())
}

func TestParseLockWindows(t *testing.T) {
j := NewJob("file", false, CmdFactory{
execPath: ExecPath{},
}, writer.FileWriter{}, pipCleaner{})
file, err := os.ReadFile("testdata/windows_requirements.txt.debricked.lock")
assert.Nil(t, err)
pipData := string(file)
packages := j.parsePipList(pipData)
gt := []string{"aiohttp", "cryptography", "numpy", "Flask", "open-source-health", "pandas", "tqdm"}
assert.Equal(t, gt, packages)
assert.False(t, j.Errors().HasError())
}

func TestRunCreateErr(t *testing.T) {
createErr := errors.New("create-error")
fileWriterMock := &writerTestdata.FileWriterMock{CreateErr: createErr}
Expand Down
14 changes: 13 additions & 1 deletion test/resolve/resolver_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package resolve

import (
"fmt"
"os"
"path/filepath"
"runtime"
"strings"
"testing"

"github.com/debricked/cli/internal/cmd/resolve"
Expand Down Expand Up @@ -49,6 +52,12 @@ func TestResolves(t *testing.T) {
lockFileName: "requirements.txt.pip.debricked.lock",
packageManager: "pip",
},
{
name: "windows",
manifestFile: "testdata/pip/windows_requirements.txt",
lockFileName: "windows_requirements.txt.pip.debricked.lock",
packageManager: "pip",
},
{
name: "basic .csproj",
manifestFile: "testdata/nuget/csproj/basic.csproj",
Expand Down Expand Up @@ -101,7 +110,10 @@ func TestResolves(t *testing.T) {
assert.NoError(t, fileErr)

actualString := string(lockFileContents)

fmt.Println(strings.Contains(actualString, "\r\n"))
if runtime.GOOS == "windows" && c.name == "windows" {
assert.Equal(t, false, true) // TODO: remove when done testing windows
}
assert.Greater(t, len(actualString), 0)

})
Expand Down
11 changes: 11 additions & 0 deletions test/resolve/testdata/pip/windows_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
azure-identity==1.15.0
azure-storage-blob==12.19.0
fastapi==0.110.0
uvicorn==0.27.1
openai==1.13.3
PyYAML==6.0.1
llama-index==0.10.14
aiohttp==3.9.3
pylint==3.1.0
llama-index-multi-modal-llms-azure-openai==0.1.4
llama-index-embeddings-azure-openai==0.1.6

0 comments on commit d4b6704

Please sign in to comment.