-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Zip files for test cases #442
Comments
Did you "grepped" for them in the tests ? Those are used to simulate git repos in the tests. If you don't zip them then git will emit weird things. |
I was using the same technique to simulate a git repo in the Mozilla importer though @pombredanne suggests to avoid zips. cls.mock_file_changes = (
{
os.path.join(TEST_DATA, "mfsa2005-29.md"),
os.path.join(TEST_DATA, "mfsa2014-30.md"),
os.path.join(TEST_DATA, "mfsa2021-01.yml"),
os.path.join(TEST_DATA, "mfsa2021-06.yml"),
os.path.join(TEST_DATA, "mfsa2021-04.yml"),
},
set(),
)
...
...
with patch(
"vulnerabilities.importers.MozillaDataSource.file_changes",
return_value=self.mock_file_changes,
):
with patch(
"vulnerabilities.importers.MozillaDataSource._ensure_repository"
):
runner.run() |
OK, so using a zip or tar for a special case of a git repo makes sense, but not for plain text test files. |
@pombredanne the tests for git repo are handled by test cases for GitDataSource along the lines https://github.com/nexB/vulnerablecode/blob/09839b9198aaf970761c21f758a0bc138458fed9/vulnerabilities/tests/test_data_source.py#L98 |
Don't directly call ImportRunner https://github.com/nexB/vulnerablecode/blob/05fcc64f2b48b186b7f742a2adf869b82293b024/vulnerabilities/tests/test_npm.py#L89 |
Currently the following importers are using zip files in their unit tests.
It needs to be discussed if they are required.
The text was updated successfully, but these errors were encountered: