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