def _coro_test_wrapper(func, self): """Run the test to set things up, then start the reactor.""" coro = Coroutine(func(self), is_watched = True) coro.start() reactor.run() if coro.state != coro.STATE_COMPLETED: if coro.result and coro.result[1]: exc_type, exc_value, exc_traceback = coro.result[1] raise exc_type, exc_value, exc_traceback else: raise Exception("Coroutine did not complete: %r" % (coro, ))
def reactor_test(coro, self): cr = coro(self) cr.start() reactor.run() self.assertEqual(cr.state, cr.STATE_COMPLETED)
#/usr/bin/env python2.5 print "Loading modules..." from chiral.core import stats from chiral.net import reactor, dbus print "Initializing..." sb = dbus.SystemBusConnection() print "Running..." reactor.run() stats.dump()
def run(): reactor.run()