]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Skip pipe and subprocess tests on windows.
authorBen Darnell <ben@bendarnell.com>
Mon, 17 Sep 2012 06:35:20 +0000 (23:35 -0700)
committerBen Darnell <ben@bendarnell.com>
Mon, 17 Sep 2012 06:35:20 +0000 (23:35 -0700)
tornado/iostream.py
tornado/test/iostream_test.py
tornado/test/process_test.py
tornado/test/util.py

index 0ec3bd6f8321bb12537e25a664287a9276fa1b9f..18b4460acd3a964ea9a3278d6674a30461d79d61 100644 (file)
@@ -43,6 +43,11 @@ try:
 except ImportError:
     ssl = None
 
+try:
+    from tornado.platform.posix import _set_nonblocking
+except ImportError:
+    _set_nonblocking = None
+
 
 class BaseIOStream(object):
     """A utility class to write to and read from a non-blocking file or socket.
@@ -804,7 +809,6 @@ class PipeIOStream(BaseIOStream):
     by `os.pipe`) rather than an open file object.
     """
     def __init__(self, fd, *args, **kwargs):
-        from tornado.platform.posix import _set_nonblocking
         self.fd = fd
         _set_nonblocking(fd)
         super(PipeIOStream, self).__init__(*args, **kwargs)
index 9f5b5cf09ccce2624047605a353bf911a8b08fe3..119a4f6cd8874b28ea108b967a190092dcae9d68 100644 (file)
@@ -4,7 +4,7 @@ from tornado.ioloop import IOLoop
 from tornado.iostream import IOStream, SSLIOStream, PipeIOStream
 from tornado.log import gen_log
 from tornado.testing import AsyncHTTPTestCase, AsyncHTTPSTestCase, AsyncTestCase, bind_unused_port, ExpectLog
-from tornado.test.util import unittest
+from tornado.test.util import unittest, skipIfNonUnix
 from tornado.util import b
 from tornado.web import RequestHandler, Application
 import errno
@@ -415,3 +415,4 @@ class TestPipeIOStream(AsyncTestCase):
         self.assertEqual(data, b("ld"))
 
         rs.close()
+TestPipeIOStream = skipIfNonUnix(TestPipeIOStream)
index 950aa8d4540fbf2b1488ddd6c5e721329dc68bc8..7bd75034078c88b195d463f69aa85561905d43a0 100644 (file)
@@ -14,7 +14,7 @@ from tornado.log import gen_log
 from tornado.process import fork_processes, task_id, Subprocess
 from tornado.simple_httpclient import SimpleAsyncHTTPClient
 from tornado.testing import bind_unused_port, ExpectLog, AsyncTestCase
-from tornado.test.util import unittest
+from tornado.test.util import unittest, skipIfNonUnix
 from tornado.util import b
 from tornado.web import RequestHandler, Application
 
@@ -120,8 +120,7 @@ class ProcessTest(unittest.TestCase):
             except Exception:
                 logging.error("exception in child process %d", id, exc_info=True)
                 raise
-ProcessTest = unittest.skipIf(os.name != 'posix' or sys.platform == 'cygwin',
-                              "non-unix platform")(ProcessTest)
+ProcessTest = skipIfNonUnix(ProcessTest)
 
 
 class SubprocessTest(AsyncTestCase):
@@ -167,3 +166,4 @@ class SubprocessTest(AsyncTestCase):
         self.assertEqual(subproc.returncode, ret)
         self.assertTrue(os.WIFSIGNALED(ret))
         self.assertEqual(os.WTERMSIG(ret), signal.SIGTERM)
+SubprocessTest = skipIfNonUnix(SubprocessTest)
index 26d843d5bf97fb4394a02cba7fb765fee5d57846..b048b5027fa703a5e7cd6dd6ae3f5fdc868b495a 100644 (file)
@@ -1,5 +1,6 @@
 from __future__ import absolute_import, division, with_statement
 
+import os
 import sys
 
 # Encapsulate the choice of unittest or unittest2 here.
@@ -8,3 +9,6 @@ if sys.version_info >= (2, 7):
     import unittest
 else:
     import unittest2 as unittest
+
+skipIfNonUnix = unittest.skipIf(os.name != 'posix' or sys.platform == 'cygwin',
+                                "non-unix platform")