mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-02 06:55:16 +00:00
[2353] Use assertRaises() instead of the excessive code
This commit is contained in:
@@ -1791,16 +1791,11 @@ class TestBossComponents(unittest.TestCase):
|
|||||||
attempts += 1
|
attempts += 1
|
||||||
time.sleep = _my_sleep
|
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
|
# We just check that an exception was thrown, and that several
|
||||||
# attempts were made to connect.
|
# 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
|
# 2 seconds of attempts every 1 second should result in 2 attempts
|
||||||
self.assertEqual(attempts, 2)
|
self.assertEqual(attempts, 2)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user