-
Notifications
You must be signed in to change notification settings - Fork 278
New implementation tests: apply black and isort automatic linting fixes #1658
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
Conversation
All of the changes included are a result of applying black on our tests on the new code. Signed-off-by: Martin Vrachev <[email protected]>
All of the changes included are a result of applying isort on our tests on the new code. Signed-off-by: Martin Vrachev <[email protected]>
Signed-off-by: Martin Vrachev <[email protected]>
Pull Request Test Coverage Report for Build 1413459481Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I support this: it's a massive patch but I'd rather have that pain now and then be able to enforce the coding style later (once we get the linters running in CI).
I've resisted the temptation to make improvement suggestions: this is (mostly) a machine generated patch and makes sense to keep it like that. LGTM.
self.assertRaises( | ||
exceptions.LengthOrHashMismatchError, | ||
snapshot_metafile.verify_length_and_hashes, | ||
data, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It think these are more evidence of how we should ban self.assertRaises()
unless it's used in a with self.assertRaises():
.
however, I'm fine with this PR being a mostly "machine-generated" change so that's just a side note.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created an issue about that #1660.
Change the instances of "self.assertRaises" to "with self.assertRaises" as using "self.assertRaises" can lead to long statements separated to multiline expressions as pointed out by Jussi here: theupdateframework#1658 (comment) On another hand "with self.assertRaises()" looks a lot better: https://github.com/theupdateframework/python-tuf/blob/589ed9e0d48aad9acaea912f409e1445d5913416/tests/test_api.py#L131 Signed-off-by: Martin Vrachev <[email protected]>
Fixes #1656
Description of the changes being introduced by the pull request:
Currently, we don't do any listing for our tests.
I believe we should enable linting (tox -e lint) for new test files.
The first step to do that would be to apply the automatic fixes proposed
by
black
and isort on the new test files testing the new code.The next step would be to propose fixes for
pylint
andmypy
and the lastthe part will be to enable the linters themselves.
Additionally, I saw one opportunity to simplify a little test_api.py and that's
what the last commit is all about.
Related to issue #1582.
Signed-off-by: Martin Vrachev [email protected]