From: Min RK Date: Wed, 11 Nov 2015 13:32:00 +0000 (+0100) Subject: test failure to set up curl http requests X-Git-Tag: v4.4.0b1~69^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1582%2Fhead;p=thirdparty%2Ftornado.git test failure to set up curl http requests ensure that it doesn't starve free curl client list --- diff --git a/tornado/test/curl_httpclient_test.py b/tornado/test/curl_httpclient_test.py index d06a7bd2a..097aec3e7 100644 --- a/tornado/test/curl_httpclient_test.py +++ b/tornado/test/curl_httpclient_test.py @@ -1,3 +1,4 @@ +# coding: utf-8 from __future__ import absolute_import, division, print_function, with_statement from hashlib import md5 @@ -83,8 +84,7 @@ class CustomFailReasonHandler(RequestHandler): class CurlHTTPClientTestCase(AsyncHTTPTestCase): def setUp(self): super(CurlHTTPClientTestCase, self).setUp() - self.http_client = CurlAsyncHTTPClient(self.io_loop, - defaults=dict(allow_ipv6=False)) + self.http_client = self.create_client() def get_app(self): return Application([ @@ -93,6 +93,11 @@ class CurlHTTPClientTestCase(AsyncHTTPTestCase): ('/custom_fail_reason', CustomFailReasonHandler), ]) + def create_client(self, **kwargs): + return CurlAsyncHTTPClient(self.io_loop, force_instance=True, + defaults=dict(allow_ipv6=False), + **kwargs) + def test_prepare_curl_callback_stack_context(self): exc_info = [] @@ -122,3 +127,8 @@ class CurlHTTPClientTestCase(AsyncHTTPTestCase): response = self.fetch('/custom_fail_reason') self.assertEqual(str(response.error), "HTTP 400: Custom reason") + def test_failed_setup(self): + self.http_client = self.create_client(max_clients=1) + for i in range(5): + response = self.fetch(u'/ユニコード') + self.assertIsNot(response.error, None)