class DispatcherTest(unittest.TestCase): def setUp(self): self.am = AgentManager() self.dispatcher = Dispatcher() self.dispatcher.daemon = True self.dispatcher.start() def test_subscription(self): agent = MockAgent() self.am.add_agent(agent) self.dispatcher.bind(agent, "test") agent.create_event() agent.start() timed_out = not agent.event_received.wait(1) if timed_out: self.fail("Event not received") def tearDown(self): AgentManager.reset_singleton() Dispatcher.reset_singleton()
def tearDown(self): AgentManager.reset_singleton() Dispatcher.reset_singleton()
def setUp(self): self.am = AgentManager() self.dispatcher = Dispatcher() self.dispatcher.daemon = True self.dispatcher.start()