Skip to content
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

New implementation tests: apply black and isort automatic linting fixes #1658

Merged
merged 3 commits into from
Nov 4, 2021

Conversation

MVrachev
Copy link
Collaborator

@MVrachev MVrachev commented Nov 2, 2021

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 and mypy and the last
the 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 mvrachev@vmware.com

All of the changes included are a result of applying black
on our tests on the new code.

Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
All of the changes included are a result of applying isort
on our tests on the new code.

Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
@MVrachev MVrachev requested a review from jku November 2, 2021 17:40
@coveralls
Copy link

Pull Request Test Coverage Report for Build 1413459481

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 97.43%

Totals Coverage Status
Change from base Build 1390970499: 0.0%
Covered Lines: 3946
Relevant Lines: 4030

💛 - Coveralls

Copy link
Member

@jku jku left a 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.

Comment on lines +616 to +620
self.assertRaises(
exceptions.LengthOrHashMismatchError,
snapshot_metafile.verify_length_and_hashes,
data,
)
Copy link
Member

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.

Copy link
Collaborator Author

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.

@jku jku merged commit ce4a60e into theupdateframework:develop Nov 4, 2021
@MVrachev MVrachev deleted the apply-linters branch November 5, 2021 15:50
MVrachev added a commit to MVrachev/tuf that referenced this pull request Nov 10, 2021
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 <mvrachev@vmware.com>
@lukpueh lukpueh mentioned this pull request Dec 13, 2021
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.

New implementation tests: apply black and isort automatic linting fixes
3 participants