Skip to content

Tests: self.assertRaises -> with self.assertRaises #1670

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

Merged
merged 1 commit into from
Nov 11, 2021

Conversation

MVrachev
Copy link
Collaborator

Fixes #1660

Description of the changes being introduced by the pull request:

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:
#1658 (comment)

On another hand "with self.assertRaises()" looks a lot better:

with self.assertRaises(DeserializationError):

Signed-off-by: Martin Vrachev [email protected]

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]>
@coveralls
Copy link

coveralls commented Nov 10, 2021

Pull Request Test Coverage Report for Build 1444383266

Warning: 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

  • 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 98.571%

Totals Coverage Status
Change from base Build 1443195620: 0.0%
Covered Lines: 3116
Relevant Lines: 3129

💛 - 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.

much better, thanks

@jku jku merged commit fa7990c into theupdateframework:develop Nov 11, 2021
@MVrachev MVrachev deleted the assert-raises-fix branch November 25, 2021 11:26
@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 style guidelines: should we ban the usage of assertRaises in testing?
3 participants