Пример #1
0
 def __call__(self, actor):
     test = self.test
     if self.istest:
         test = actor.app.runner.before_test_function_run(test)
     inject_async_assert(test)
     test_function = getattr(test, self.method_name)
     return safe_async(test_function).add_both(partial(self._end, actor))\
                                     .set_timeout(self.timeout)
Пример #2
0
 def testTooManyRedirects(self):
     http = self.client()
     r = safe_async(http.get, (self.httpbin('redirect', '5'),),
                             {'max_redirects': 2})
     # do this so that the test suite does not fail on the test
     yield r.addBoth(lambda f: [f])
     r = r.result[0]
     self.assertTrue(is_failure(r))
     self.assertTrue(isinstance(r.trace[1], httpurl.TooManyRedirects))
Пример #3
0
 def on_event(self, worker, fd, request):
     request = self.request_instance(worker, fd, request)
     if request is not None:
         c = self.local.current_requests
         if c is None:
             c = []
             self.local.current_requests = c
         c.append(request)
         yield safe_async(request.start, args=(worker,))
         try:
             c.remove(request)
         except ValueError:
             pass
Пример #4
0
 def do_stream(self, request):
     body = safe_async(self.body.content, request)
     yield '<!DOCTYPE html>\n'
     yield '<html%s>\n' % self.flatatt()
     yield body.add_callback(partial(self._head, request))
     yield '\n</html>'
Пример #5
0
 def _(*args, **kwargs):
     app = args[0].params.app
     safe_async(f, args, kwargs).addBoth(lambda r: fire(r, app))
Пример #6
0
 def do_stream(self, request):
     body = safe_async(self.body.content, request)
     yield '<!DOCTYPE html>\n'
     yield '<html%s>\n' % self.flatatt()
     yield body.add_callback(partial(self._head, request))
     yield '\n</html>'