New style guidelines: should we ban the usage of assertRaises in testing? #1660
Labels
backlog
Issues to address with priority for current development goals
discussion
Discussions related to the design, implementation and operation of the project
testing
Milestone
Description of issue or feature request:
Currently our code style guidelines doesn't specify anything about the usage of
self.assertRaises
vs the usage ofwith self.assertRaises():
Using
self.assertRaises
can lead to long statements separated to multiline expressions as pointed out by @jku here: #1658 (comment).On another hand
with self.assertRaises():
looks better in my opinion:python-tuf/tests/test_api.py
Line 131 in 589ed9e
Long expressions look a lot better
python-tuf/tests/test_api.py
Line 210 in 589ed9e
with self.assertRaises():
than usingself.assertRaises():
as pointed out in Jussi's comment.Current behavior:
No guidelines about
self.assertRaises
vswith self.assertRaises():
.Expected behavior:
The question is should we specify something more concrete?
EDIT: We decided we would remove all instances of
self.assertRaises
and replace them withwith self.assertRaises
.The text was updated successfully, but these errors were encountered: