Threads exceptions handling

pass exceptions throw Queue so MainThread can propagate exceptions to make tests failed when needed

darcs-hash:20061009173419-86b55-9197a944aa629ab43f55d56662b8f873036cc60e.gz
This commit is contained in:
David Rousselie
2006-10-09 19:34:19 +02:00
parent 9e28468b81
commit cb016a5406
2 changed files with 27 additions and 9 deletions

View File

@@ -127,6 +127,7 @@ class JCLComponent_TestCase(unittest.TestCase):
del account.hub.threadConnection
def test_run(self):
self.comp.time_unit = 1
self.comp.stream = MockStream()
self.comp.stream_class = MockStream
run_thread = threading.Thread(target = self.comp.run, \
@@ -151,6 +152,15 @@ class JCLComponent_TestCase(unittest.TestCase):
if self.max_tick_count == 0:
self.comp.running = False
def test_time_handler(self):
self.comp.time_unit = 1
self.max_tick_count = 2
self.comp.handle_tick = self.__handle_tick_test_time_handler
self.comp.running = True
self.comp.time_handler()
self.assertEquals(self.max_tick_count, 0)
self.assertFalse(self.comp.running)
def test_authenticated_handler(self):
self.comp.stream = MockStream()
self.comp.authenticated()