Commit 256dfa9f authored by Denis Bilenko's avatar Denis Bilenko

test__api.py: ignore tests with socketpair on windows

parent d019fc6a
...@@ -62,30 +62,32 @@ class Test(greentest.TestCase): ...@@ -62,30 +62,32 @@ class Test(greentest.TestCase):
assert 'Invalid switch' in str(result), repr(str(result)) assert 'Invalid switch' in str(result), repr(str(result))
switcher.kill() switcher.kill()
def _test_wait_read_invalid_switch(self, sleep): if hasattr(socket, 'socketpair'):
sock1, sock2 = socket.socketpair()
try: def _test_wait_read_invalid_switch(self, sleep):
p = gevent.spawn(util.wrap_errors(AssertionError, socket.wait_read), sock1.fileno()) sock1, sock2 = socket.socketpair()
gevent.get_hub().loop.run_callback(switch_None, p) try:
if sleep is not None: p = gevent.spawn(util.wrap_errors(AssertionError, socket.wait_read), sock1.fileno())
gevent.sleep(sleep) gevent.get_hub().loop.run_callback(switch_None, p)
result = p.get() if sleep is not None:
assert isinstance(result, AssertionError), result gevent.sleep(sleep)
assert 'Invalid switch' in str(result), repr(str(result)) result = p.get()
finally: assert isinstance(result, AssertionError), result
sock1.close() assert 'Invalid switch' in str(result), repr(str(result))
sock2.close() finally:
sock1.close()
def test_invalid_switch_None(self): sock2.close()
self._test_wait_read_invalid_switch(None)
def test_invalid_switch_None(self):
def test_invalid_switch_0(self): self._test_wait_read_invalid_switch(None)
self._test_wait_read_invalid_switch(0)
def test_invalid_switch_0(self):
def test_invalid_switch_1(self): self._test_wait_read_invalid_switch(0)
self._test_wait_read_invalid_switch(0.001)
def test_invalid_switch_1(self):
# we don't test wait_write the same way, because socket is always ready to write self._test_wait_read_invalid_switch(0.001)
# we don't test wait_write the same way, because socket is always ready to write
def switch_None(g): def switch_None(g):
......
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