Skip to content

test/fix: add tests for Python & Go resolvers and fix module caching bug#3

Open
Jaydeep869 wants to merge 1 commit intoSBOMit:masterfrom
Jaydeep869:fix-resolver-logic-and-tests
Open

test/fix: add tests for Python & Go resolvers and fix module caching bug#3
Jaydeep869 wants to merge 1 commit intoSBOMit:masterfrom
Jaydeep869:fix-resolver-logic-and-tests

Conversation

@Jaydeep869
Copy link
Copy Markdown
Contributor

Description

This PR improves the testing coverage for the core ecosystem resolvers ahead of the potential Trivy integration work, starting with Python and Go.

While adding tests for extractorModuleVersion in the GoResolver, I discovered a bug where moduleDirRe was too greedy and incorrectly intercepting module cache files (e.g., pkg/mod/cache/...) before moduleCacheRe could evaluate them, causing their ecosystem paths to evaluate incorrectly.

Changes Made

  • Added python_test.go to cover NormalizePackageName and Python dist-info resolution logic.
  • Added go_test.go to test basic pkg/mod/ evaluation and decoding.
  • Fixed go.go: Swapped the evaluation sequence in extractModuleVersion so moduleCacheRe correctly consumes cache files before moduleDirRe can partially match them.

Signed-off-by: jaydeep869 <jaydeeppokhariya2106@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant