Commit 83b8e650 authored by Jason Madden's avatar Jason Madden

More libuv test adaptations.

parent c468ab9a
......@@ -157,6 +157,11 @@ if LIBUV:
else:
skipOnLibuv = _do_not_skip
if LIBUV and RUNNING_ON_CI:
skipOnLibuvOnCI = unittest.skip
else:
skipOnLibuvOnCI = _do_not_skip
class ExpectedException(Exception):
"""An exception whose traceback should be ignored by the hub"""
......
......@@ -38,6 +38,9 @@ class Test(greentest.TestCase):
finally:
receiver.kill()
# XXX: This is possibly due to the bad behaviour of small sleeps?
# The timeout is the global test timeout, 10s
@greentest.skipOnLibuvOnCI("Sometimes randomly times out")
def test_recv_twice(self):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(('localhost', self.server.server_port))
......
......@@ -57,16 +57,18 @@ class Test(greentest.TestCase):
def test_system_error(self):
self.start(raise_, SystemError(MSG))
try:
gevent.sleep(0.001)
except SystemError as ex:
assert str(ex) == MSG, repr(str(ex))
else:
raise AssertionError('must raise SystemError')
with self.assertRaisesRegex(SystemError,
MSG):
gevent.sleep(0.002)
def test_exception(self):
self.start(raise_, Exception('regular exception must not kill the program'))
gevent.sleep(0.001)
# XXX: libuv: libuv only allows a 0.001 minimum sleep time argument.
# If we pass that, sometimes TestCallback finds that the callback has not run
# when it tries to tearDown the test. Doubling that actually lets the callback run.
# So there's some interaction with minimum timers and the callback timer (?) which
# uses a timer of 0, asking to be run immediately on the next loop.
gevent.sleep(0.002)
class TestCallback(Test):
......
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