From: Mukund Sivaraman Date: Mon, 10 Dec 2012 00:44:00 +0000 (+0530) Subject: [2353] Use assertRaises() instead of the excessive code X-Git-Tag: bind10-1.0.0-beta-release~19^2~25 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=366f210b8217811fb1cd96ed996f3491c7d9766f;p=thirdparty%2Fkea.git [2353] Use assertRaises() instead of the excessive code --- diff --git a/src/bin/bind10/tests/bind10_test.py.in b/src/bin/bind10/tests/bind10_test.py.in index ac9380e28c..d2b1384a09 100644 --- a/src/bin/bind10/tests/bind10_test.py.in +++ b/src/bin/bind10/tests/bind10_test.py.in @@ -1791,16 +1791,11 @@ class TestBossComponents(unittest.TestCase): attempts += 1 time.sleep = _my_sleep - thrown = False - # An exception will be thrown here when it eventually times out. - try: - pi = bob.start_cfgmgr() - except bind10_src.ProcessStartError as e: - thrown = True - # We just check that an exception was thrown, and that several # attempts were made to connect. - self.assertTrue(thrown) + with self.assertRaises(bind10_src.ProcessStartError): + pi = bob.start_cfgmgr() + # 2 seconds of attempts every 1 second should result in 2 attempts self.assertEqual(attempts, 2)