Commit efe644cb authored by Denis Bilenko's avatar Denis Bilenko

test__hub.py: do not call time.sleep(-1) on windows because it hangs

parent 32fa7dec
......@@ -23,6 +23,7 @@ import greentest
import unittest
import time
import re
import sys
import gevent
from gevent import core
from gevent import socket
......@@ -130,16 +131,20 @@ class TestSleep(greentest.GenericWaitTestCase):
def test_negative(self):
self.switch_expected = False
self.assertRaises(IOError, gevent.sleep, -1)
from time import sleep as real_sleep
try:
real_sleep(-1.1)
except IOError, real_ex:
pass
if sys.platform != 'win32':
from time import sleep as real_sleep
try:
real_sleep(-0.1)
except IOError, real_ex:
pass
else:
# XXX real_sleep(-0.1) hangs on win32
real_ex = "[Errno 22] Invalid argument"
try:
gevent.sleep(-1.1)
gevent.sleep(-0.1)
except IOError, gevent_ex:
pass
self.assertEqual(repr(gevent_ex), repr(real_ex))
self.assertEqual(str(gevent_ex), str(real_ex))
class Expected(Exception):
......
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