def thread_test(method):
 @functools.wraps(method)
 def Wrapper(self):
  thread = TestThread(partial(method, self), partial(self.io_loop.add_callback, self.stop))
  thread.start()
  self.wait()
  thread.MaybeRaise()
 return Wrapper

def thread_test ( method ) : @ functools . wraps ( method ) def Wrapper ( self ) : thread = TestThread ( partial ( method , self ) , partial ( self . io_loop . add_callback , self . stop ) ) thread . start ( ) self . wait ( ) thread . MaybeRaise ( ) return Wrapper
decorator for tests which need to be run synchronously .