]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2353] Use assertRaises() instead of the excessive code
authorMukund Sivaraman <muks@isc.org>
Thu, 29 Nov 2012 02:47:55 +0000 (08:17 +0530)
committerMukund Sivaraman <muks@isc.org>
Thu, 29 Nov 2012 02:47:55 +0000 (08:17 +0530)
src/bin/bind10/tests/bind10_test.py.in

index e4bf192b466d640622e7f9b9340e961e0babbae8..f26052bf35ca7687aff3e7aee3a46caca5a53322 100644 (file)
@@ -1619,16 +1619,11 @@ class TestBossComponents(unittest.TestCase):
             return tmp_time()
         time.time = _my_time
 
-        thrown = False
-        # An exception will be thrown here when it eventually times out.
-        try:
+        with self.assertRaises(bind10_src.CChannelConnectError):
+            # An exception will be thrown here when it eventually times
+            # out.
             pi = bob.start_msgq()
-        except bind10_src.CChannelConnectError as e:
-            thrown = True
 
-        # We just check that an exception was thrown, and that several
-        # attempts were made to connect.
-        self.assertTrue(thrown)
         # 1 second of attempts every 0.1 seconds should result in at
         # least 5 attempts
         self.assertGreater(attempts, 5)