Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Skip pipe and subprocess tests on windows.
  • Loading branch information
bdarnell committed Sep 17, 2012
1 parent 2a2b405 commit ca22303
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
6 changes: 5 additions & 1 deletion tornado/iostream.py
Expand Up @@ -43,6 +43,11 @@
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.
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion tornado/test/iostream_test.py
Expand Up @@ -4,7 +4,7 @@
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
Expand Down Expand Up @@ -415,3 +415,4 @@ def test_pipe_iostream(self):
self.assertEqual(data, b("ld"))

rs.close()
TestPipeIOStream = skipIfNonUnix(TestPipeIOStream)
6 changes: 3 additions & 3 deletions tornado/test/process_test.py
Expand Up @@ -14,7 +14,7 @@
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

Expand Down Expand Up @@ -120,8 +120,7 @@ def fetch(url, fail_ok=False):
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):
Expand Down Expand Up @@ -167,3 +166,4 @@ def test_sigchild_signal(self):
self.assertEqual(subproc.returncode, ret)
self.assertTrue(os.WIFSIGNALED(ret))
self.assertEqual(os.WTERMSIG(ret), signal.SIGTERM)
SubprocessTest = skipIfNonUnix(SubprocessTest)
4 changes: 4 additions & 0 deletions tornado/test/util.py
@@ -1,5 +1,6 @@
from __future__ import absolute_import, division, with_statement

import os
import sys

# Encapsulate the choice of unittest or unittest2 here.
Expand All @@ -8,3 +9,6 @@
import unittest
else:
import unittest2 as unittest

skipIfNonUnix = unittest.skipIf(os.name != 'posix' or sys.platform == 'cygwin',
"non-unix platform")

0 comments on commit ca22303

Please sign in to comment.