2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-09-01 06:25:34 +00:00

[2353] Restore isc.config.ModuleCCSession during tearDown()

This commit is contained in:
Mukund Sivaraman
2012-12-06 08:17:01 +05:30
parent 87cd15b3cc
commit 4f806512c8

View File

@@ -1233,14 +1233,15 @@ class TestBossComponents(unittest.TestCase):
} }
self._tmp_time = None self._tmp_time = None
self._tmp_sleep = None self._tmp_sleep = None
self._tmp_ccsession = None
def tearDown(self): def tearDown(self):
if self._tmp_time is not None: if self._tmp_time is not None:
time.time = self._tmp_time time.time = self._tmp_time
if self._tmp_sleep is not None: if self._tmp_sleep is not None:
time.sleep = self._tmp_sleep time.sleep = self._tmp_sleep
if self._tmp_ccsession is not None:
isc.config.ModuleCCSession = self._tmp_ccsession
def __unary_hook(self, param): def __unary_hook(self, param):
""" """
@@ -1760,7 +1761,7 @@ class TestBossComponents(unittest.TestCase):
def start(self): def start(self):
self.started = True self.started = True
bob = MockBobSimple() bob = MockBobSimple()
tmp = isc.config.ModuleCCSession self._tmp_ccsession = isc.config.ModuleCCSession
isc.config.ModuleCCSession = DummySession isc.config.ModuleCCSession = DummySession
bob.start_ccsession({}) bob.start_ccsession({})
@@ -1770,7 +1771,7 @@ class TestBossComponents(unittest.TestCase):
self.assertEqual(bob.msgq_socket_file, bob.ccs.socket_file) self.assertEqual(bob.msgq_socket_file, bob.ccs.socket_file)
self.assertTrue(bob.ccs.started) self.assertTrue(bob.ccs.started)
isc.config.ModuleCCSession = tmp # isc.config.ModuleCCSession is restored during tearDown().
def test_start_process(self): def test_start_process(self):
'''Test that processes can be started.''' '''Test that processes can be started.'''