Esempio n. 1
0
 def run_one_thread(self, msg):
     runner = self.MockTestRunner()
     port = None
     options = mocktool.MockOptions(child_processes="1")
     starting_queue = Queue.Queue()
     stopping_queue = Queue.Queue()
     broker = message_broker.MultiThreadedBroker(port, options)
     broker._test_runner = runner
     child_thread = TestThread(starting_queue, stopping_queue)
     broker._workers["worker-0"] = message_broker._WorkerState("worker-0")
     broker._workers["worker-0"].thread = child_thread
     child_thread.start()
     started_msg = starting_queue.get()
     stopping_queue.put(msg)
     return broker.run_message_loop()
 def run_one_thread(self, msg):
     runner = self.MockTestRunner()
     port = None
     options = mocktool.MockOptions(child_processes='1')
     starting_queue = Queue.Queue()
     stopping_queue = Queue.Queue()
     broker = message_broker.MultiThreadedBroker(port, options)
     broker._test_runner = runner
     child_thread = TestThread(starting_queue, stopping_queue)
     broker._workers['worker-0'] = message_broker._WorkerState('worker-0')
     broker._workers['worker-0'].thread = child_thread
     child_thread.start()
     started_msg = starting_queue.get()
     stopping_queue.put(msg)
     res = broker.run_message_loop()
     if msg == 'Timeout':
         child_thread._timeout_queue.put('done')
     child_thread.join(1.0)
     self.assertFalse(child_thread.isAlive())
     return res
Esempio n. 3
0
 def run_one_thread(self, msg):
     runner = self.MockTestRunner()
     port = None
     options = mocktool.MockOptions(child_processes='1')
     starting_queue = Queue.Queue()
     stopping_queue = Queue.Queue()
     broker = message_broker.MultiThreadedBroker(port, options)
     broker._test_runner = runner
     child_thread = TestThread(starting_queue, stopping_queue)
     broker._workers['worker-0'] = message_broker._WorkerState('worker-0')
     broker._workers['worker-0'].thread = child_thread
     child_thread.start()
     started_msg = starting_queue.get()
     stopping_queue.put(msg)
     res = broker.run_message_loop()
     if msg == 'Timeout':
         child_thread._timeout_queue.put('done')
     child_thread.join(1.0)
     self.assertFalse(child_thread.isAlive())
     return res