Commit 36284050 authored by Jason Madden's avatar Jason Madden

More windows workarounds.

parent b43f8686
...@@ -50,7 +50,7 @@ _cdef = _cdef.replace("GEVENT_STRUCT_DONE _;", '...;') ...@@ -50,7 +50,7 @@ _cdef = _cdef.replace("GEVENT_STRUCT_DONE _;", '...;')
# which we will treat as an 'unsigned long' or 'unsigned long long' # which we will treat as an 'unsigned long' or 'unsigned long long'
# since it comes through 'fileno()' where it has been cast as an int. # since it comes through 'fileno()' where it has been cast as an int.
# See class watcher.io # See class watcher.io
_void_pointer_as_integer = 'intptr_t' #'unsigned long' if system_bits() == 32 else 'unsigned long long' _void_pointer_as_integer = 'intptr_t'
_cdef = _cdef.replace("GEVENT_UV_OS_SOCK_T", 'int' if not WIN else _void_pointer_as_integer) _cdef = _cdef.replace("GEVENT_UV_OS_SOCK_T", 'int' if not WIN else _void_pointer_as_integer)
......
...@@ -68,7 +68,8 @@ if sys.platform == 'win32': ...@@ -68,7 +68,8 @@ if sys.platform == 'win32':
# thread in a timely fashion, leading to 'os.close(4) must # thread in a timely fashion, leading to 'os.close(4) must
# not succeed' in test_del_close. We have the same thing # not succeed' in test_del_close. We have the same thing
# with flushing and closing in test_newlines. Both of # with flushing and closing in test_newlines. Both of
# these are most commonly (only?) observed on Py27/64-bit # these are most commonly (only?) observed on Py27/64-bit.
# They also appear on 64-bit 3.6 with libuv
'FLAKY test__fileobject.py', 'FLAKY test__fileobject.py',
] ]
......
...@@ -207,6 +207,17 @@ if LIBUV: ...@@ -207,6 +207,17 @@ if LIBUV:
'test_signal.SiginterruptTest.test_siginterrupt_off', 'test_signal.SiginterruptTest.test_siginterrupt_off',
] ]
if PY3:
disabled_tests += [
# This test wants to pass an arbitrary fileno
# to a socket and do things with it. libuv doesn't like this,
# it raises EPERM. It is disabled on windows already.
# It depends on whether we had a fd already open and multiplexed with
'test_socket.GeneralModuleTests.test_unknown_socket_family_repr',
]
if sys.platform.startswith('linux'): if sys.platform.startswith('linux'):
disabled_tests += [ disabled_tests += [
# crashes with EPERM, which aborts the epoll loop, even # crashes with EPERM, which aborts the epoll loop, even
...@@ -226,6 +237,8 @@ if LIBUV: ...@@ -226,6 +237,8 @@ if LIBUV:
'test_selectors.PollSelectorTestCase.test_timeout', 'test_selectors.PollSelectorTestCase.test_timeout',
] ]
if WIN and PYPY: if WIN and PYPY:
# From PyPy2-v5.9.0, using its version of tests, # From PyPy2-v5.9.0, using its version of tests,
# which do work on darwin (and possibly linux?) # which do work on darwin (and possibly linux?)
......
...@@ -17,6 +17,8 @@ EV_USE_INOTIFY = getattr(gevent.core, 'EV_USE_INOTIFY', None) ...@@ -17,6 +17,8 @@ EV_USE_INOTIFY = getattr(gevent.core, 'EV_USE_INOTIFY', None)
WIN = sys.platform.startswith('win') WIN = sys.platform.startswith('win')
LIBUV = getattr(gevent.core, 'libuv', None)
def test(): def test():
try: try:
open(filename, 'wb', buffering=0).close() open(filename, 'wb', buffering=0).close()
...@@ -51,10 +53,10 @@ def test(): ...@@ -51,10 +53,10 @@ def test():
else: else:
raise raise
else: else:
if WIN: if WIN and not LIBUV:
# The ImportError is only raised for the first time; # The ImportError is only raised for the first time;
# after that, the attribute starts returning None # after that, the attribute starts returning None
assert x is None, "Only None is supported on Windows" assert x is None, ("Only None is supported on Windows", x)
if none: if none:
assert x is None, x assert x is None, x
else: else:
...@@ -67,6 +69,7 @@ def test(): ...@@ -67,6 +69,7 @@ def test():
if now - start - DELAY <= 0.0: if now - start - DELAY <= 0.0:
# Sigh. This is especially true on PyPy. # Sigh. This is especially true on PyPy.
assert WIN, ("Bad timer resolution expected on Windows, test is useless", start, now) assert WIN, ("Bad timer resolution expected on Windows, test is useless", start, now)
print("On windows, bad timer resolution prevents this test from running")
return return
reaction = now - start - DELAY reaction = now - start - DELAY
print('Watcher %s reacted after %.4f seconds (write)' % (watcher, reaction)) print('Watcher %s reacted after %.4f seconds (write)' % (watcher, reaction))
......
...@@ -9,6 +9,9 @@ import test__socket ...@@ -9,6 +9,9 @@ import test__socket
import ssl import ssl
import unittest
from gevent.hub import LoopExit
class TestSSL(test__socket.TestTCP): class TestSSL(test__socket.TestTCP):
certfile = os.path.join(os.path.dirname(__file__), 'test_server.crt') certfile = os.path.join(os.path.dirname(__file__), 'test_server.crt')
...@@ -57,6 +60,16 @@ class TestSSL(test__socket.TestTCP): ...@@ -57,6 +60,16 @@ class TestSSL(test__socket.TestTCP):
client.close() client.close()
server_sock[0][0].close() server_sock[0][0].close()
elif greentest.LIBUV:
def test_fullduplex(self):
try:
super(TestSSL, self).test_fullduplex()
except LoopExit:
# XXX: Unable to duplicate locally
raise unittest.SkipTest("libuv on Windows sometimes raises LoopExit")
@greentest.ignores_leakcheck @greentest.ignores_leakcheck
def test_empty_send(self): def test_empty_send(self):
# Issue 719 # Issue 719
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment