Commit 7f9fedfa authored by Ron Rothman's avatar Ron Rothman Committed by Jason Madden

use assertRaises

parent 561c4d90
...@@ -212,14 +212,8 @@ class PoolBasicTests(greentest.TestCase): ...@@ -212,14 +212,8 @@ class PoolBasicTests(greentest.TestCase):
second = gevent.spawn(gevent.sleep, 1000) second = gevent.spawn(gevent.sleep, 1000)
try: try:
p.add(first) p.add(first)
try: with self.assertRaises(pool.Full):
p.add(second, blocking=False) p.add(second, blocking=False)
except pool.Full:
pass # expected
except Exception:
raise AssertionError('Expected pool.Full')
else:
raise AssertionError('Expected pool.Full')
finally: finally:
second.kill() second.kill()
finally: finally:
...@@ -232,14 +226,8 @@ class PoolBasicTests(greentest.TestCase): ...@@ -232,14 +226,8 @@ class PoolBasicTests(greentest.TestCase):
second = gevent.spawn(gevent.sleep, 1000) second = gevent.spawn(gevent.sleep, 1000)
try: try:
p.add(first) p.add(first)
try: with self.assertRaises(Timeout):
p.add(second, timeout=0.100) p.add(second, timeout=0.100)
except Timeout:
pass # expected
except Exception:
raise AssertionError('expected Timeout')
else:
raise AssertionError('expected Timeout')
finally: finally:
second.kill() second.kill()
finally: finally:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment