From dec2d7444d5abcfeea1a89a0b7df425ffac196a2 Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Sat, 19 Jan 2013 14:35:28 -0500 Subject: [PATCH] No more need to check for 'ssl is None' or 'multiprocessing is None' --- tornado/process.py | 9 ++++----- tornado/simple_httpclient.py | 3 --- tornado/test/httpserver_test.py | 4 ---- tornado/test/iostream_test.py | 4 ---- 4 files changed, 4 insertions(+), 16 deletions(-) diff --git a/tornado/process.py b/tornado/process.py index e0153f45b..eb6157b23 100644 --- a/tornado/process.py +++ b/tornado/process.py @@ -41,11 +41,10 @@ except NameError: def cpu_count(): """Returns the number of processors on this machine.""" - if multiprocessing is not None: - try: - return multiprocessing.cpu_count() - except NotImplementedError: - pass + try: + return multiprocessing.cpu_count() + except NotImplementedError: + pass try: return os.sysconf("SC_NPROCESSORS_CONF") except ValueError: diff --git a/tornado/simple_httpclient.py b/tornado/simple_httpclient.py index 535be909e..65b6a6b3b 100644 --- a/tornado/simple_httpclient.py +++ b/tornado/simple_httpclient.py @@ -130,9 +130,6 @@ class _HTTPConnection(object): self._timeout = None with stack_context.ExceptionStackContext(self._handle_exception): self.parsed = urlparse.urlsplit(_unicode(self.request.url)) - if ssl is None and self.parsed.scheme == "https": - raise ValueError("HTTPS requires either python2.6+ or " - "curl_httpclient") if self.parsed.scheme not in ("http", "https"): raise ValueError("Unsupported url scheme: %s" % self.request.url) diff --git a/tornado/test/httpserver_test.py b/tornado/test/httpserver_test.py index f910c9bb4..6038dc290 100644 --- a/tornado/test/httpserver_test.py +++ b/tornado/test/httpserver_test.py @@ -45,7 +45,6 @@ class HelloWorldRequestHandler(RequestHandler): self.finish("Got %d bytes in POST" % len(self.request.body)) -skipIfNoSSL = unittest.skipIf(ssl is None, "ssl module not present") # In pre-1.0 versions of openssl, SSLv23 clients always send SSLv2 # ClientHello messages, which are rejected by SSLv3 and TLSv1 # servers. Note that while the OPENSSL_VERSION_INFO was formally @@ -98,20 +97,17 @@ class SSLTestMixin(object): # of SSLv23 allows it. -@skipIfNoSSL class SSLv23Test(BaseSSLTest, SSLTestMixin): def get_ssl_version(self): return ssl.PROTOCOL_SSLv23 -@skipIfNoSSL @skipIfOldSSL class SSLv3Test(BaseSSLTest, SSLTestMixin): def get_ssl_version(self): return ssl.PROTOCOL_SSLv3 -@skipIfNoSSL @skipIfOldSSL class TLSv1Test(BaseSSLTest, SSLTestMixin): def get_ssl_version(self): diff --git a/tornado/test/iostream_test.py b/tornado/test/iostream_test.py index 23062bb64..a7793ec0a 100644 --- a/tornado/test/iostream_test.py +++ b/tornado/test/iostream_test.py @@ -15,8 +15,6 @@ import socket import ssl import sys -skipIfNoSSL = unittest.skipIf(ssl is None, "ssl module not present") - class HelloHandler(RequestHandler): def get(self): @@ -440,7 +438,6 @@ class TestIOStreamWebHTTP(TestIOStreamWebMixin, AsyncHTTPTestCase): return IOStream(socket.socket(), io_loop=self.io_loop) -@skipIfNoSSL class TestIOStreamWebHTTPS(TestIOStreamWebMixin, AsyncHTTPSTestCase): def _make_client_iostream(self): return SSLIOStream(socket.socket(), io_loop=self.io_loop) @@ -454,7 +451,6 @@ class TestIOStream(TestIOStreamMixin, AsyncTestCase): return IOStream(connection, io_loop=self.io_loop, **kwargs) -@skipIfNoSSL class TestIOStreamSSL(TestIOStreamMixin, AsyncTestCase): def _make_server_iostream(self, connection, **kwargs): ssl_options = dict( -- 2.47.2