Use pytest.raises() instead of try/catch with asser 0

This is somehow more readable, and enable using the features of pytest's ExeptionInfo (such as errisinstance).
This commit is contained in:
Reuven 2016-03-04 13:30:40 +02:00
parent e7d548595e
commit 4dc2ef19ea
5 changed files with 39 additions and 84 deletions

View file

@ -140,12 +140,8 @@ def test_manual_context_binding():
ctx.push()
assert index() == 'Hello World!'
ctx.pop()
try:
with pytest.raises(RuntimeError):
index()
except RuntimeError:
pass
else:
assert 0, 'expected runtime error'
@pytest.mark.skipif(greenlet is None, reason='greenlet not installed')
def test_greenlet_context_copying():