Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
attiasas committed Jun 2, 2024
1 parent 5397c91 commit 744c313
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions utils/coreutils/techutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ var technologiesData = map[Technology]TechData{
Pip: {
packageType: Pypi,
indicators: map[string]ContentValidator{"pyproject.toml": pyProjectTomlIndicatorContent(Pip), "setup.py": nil, "requirements.txt": nil},
packageDescriptors: []string{"setup.py", "requirements.txt"},
packageDescriptors: []string{"setup.py", "requirements.txt", "pyproject.toml"},
exclude: []string{"Pipfile", "Pipfile.lock", "poetry.lock"},
applicabilityScannable: true,
},
Expand Down Expand Up @@ -181,7 +181,7 @@ func pyProjectTomlIndicatorContent(tech Technology) ContentValidator {
return false
}
// Default to Pip
return tech == Pip
return true
}
}

Expand Down
6 changes: 4 additions & 2 deletions utils/coreutils/techutils_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package coreutils

import (
"fmt"
"os"
"path/filepath"
"reflect"
Expand Down Expand Up @@ -489,6 +490,7 @@ func TestGetTechInformationFromWorkingDir(t *testing.T) {
"dir": {filepath.Join("dir", "blabla.txt")},
filepath.Join("users_dir", "test", "package"): {filepath.Join("users_dir", "test", "package", "setup.py")},
filepath.Join("users_dir", "test", "package2"): {filepath.Join("users_dir", "test", "package2", "requirements.txt")},
projectDir: {filepath.Join(projectDir, "pyproject.toml")},
},
},
{
Expand Down Expand Up @@ -526,9 +528,9 @@ func TestGetTechInformationFromWorkingDir(t *testing.T) {
assert.NoError(t, err)
expectedKeys := maps.Keys(test.expected)
actualKeys := maps.Keys(techInformation)
assert.ElementsMatch(t, expectedKeys, actualKeys, "expected: %s, actual: %s", expectedKeys, actualKeys)
assert.ElementsMatch(t, expectedKeys, actualKeys, fmt.Sprintf("expected: %v, actual: %v", expectedKeys, actualKeys))
for key, value := range test.expected {
assert.ElementsMatch(t, value, techInformation[key], "expected: %s, actual: %s", value, techInformation[key])
assert.ElementsMatch(t, value, techInformation[key], fmt.Sprintf("expected: %v, actual: %v", value, techInformation[key]))
}
})
}
Expand Down

0 comments on commit 744c313

Please sign in to comment.