Skip to content

test(parsers): Add tests for js and Python parsers#4878

Merged
terriko merged 2 commits intoossf:mainfrom
JigyasuRajput:test/improve-coverage-js-python
Mar 7, 2025
Merged

test(parsers): Add tests for js and Python parsers#4878
terriko merged 2 commits intoossf:mainfrom
JigyasuRajput:test/improve-coverage-js-python

Conversation

@JigyasuRajput
Copy link
Contributor

@JigyasuRajput JigyasuRajput commented Mar 2, 2025

Description:

Fixes #4874

This PR improves test coverage for Javascript and Python parsers

Changes:

  • JavaScript Parser:
    • Added tests for process_yarn_lock (yarn.lock regex parsing).
    • Added tests for process_package_lock_lockfile_v2 (package-lock.json v2 parsing).
  • Python Parser:
    • Tested run_checker in PythonRequirementsParser for subprocess errors.
    • Tested run_checker in PythonParser for invalid METADATA/PKG-INFO handling.

Testing:

  • All tests pass successfully via pytest.
  • Ensures key parsing logic is correctly validated.

@JigyasuRajput JigyasuRajput requested a review from terriko March 4, 2025 21:16
@terriko
Copy link
Collaborator

terriko commented Mar 5, 2025

I believe with the current Github Actions config, these will wind up running every time, when most of our language parsers run tests only in the longtest job. I've kicked off the tests to actually run so we can get some time data before we decide the best path: it probably makes conceptual better sense to group them with the other parser tests, but if they're fast enough maybe running them for every version of python would be fine.

@JigyasuRajput
Copy link
Contributor Author

I believe with the current Github Actions config, these will wind up running every time, when most of our language parsers run tests only in the longtest job. I've kicked off the tests to actually run so we can get some time data before we decide the best path: it probably makes conceptual better sense to group them with the other parser tests, but if they're fast enough maybe running them for every version of python would be fine.

Hey! @terriko,
Thanks for the follow-up!
I agree with you, should I include these into the long tests?

Copy link
Collaborator

@terriko terriko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't look like any of these made it into the top 50 slowest tests according to the logs I looked at (I admit, I didn't look at every single version of python). So I think we'll leave them as is rather than shunting them off with the slower tests.

Thanks for working on this; let's get it merged!

@terriko terriko merged commit ffe6f8d into ossf:main Mar 7, 2025
24 checks passed
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.

test: Improve Test Coverage for JavaScript and Python Package Parsers

2 participants