Commit 8f0924ee authored by Jason Madden's avatar Jason Madden

Fix test__semaphore.py under PyPy3 by raising the right (wrong, really)...

Fix test__semaphore.py under PyPy3 by raising the right (wrong, really) exception type that PyPy does.
parent c93c89fa
...@@ -31,6 +31,7 @@ else: ...@@ -31,6 +31,7 @@ else:
'start_new'] 'start_new']
error = __thread__.error error = __thread__.error
from gevent._compat import PY3 from gevent._compat import PY3
from gevent._compat import PYPY
from gevent._util import copy_globals from gevent._util import copy_globals
from gevent.hub import getcurrent, GreenletExit from gevent.hub import getcurrent, GreenletExit
from gevent.greenlet import Greenlet from gevent.greenlet import Greenlet
...@@ -58,6 +59,9 @@ class LockType(BoundedSemaphore): ...@@ -58,6 +59,9 @@ class LockType(BoundedSemaphore):
# and any other API changes we need to make to match behaviour # and any other API changes we need to make to match behaviour
_OVER_RELEASE_ERROR = __thread__.error _OVER_RELEASE_ERROR = __thread__.error
if PYPY and PY3:
_OVER_RELEASE_ERROR = RuntimeError
if PY3: if PY3:
_TIMEOUT_MAX = __thread__.TIMEOUT_MAX # python 2: pylint:disable=no-member _TIMEOUT_MAX = __thread__.TIMEOUT_MAX # python 2: pylint:disable=no-member
......
...@@ -67,7 +67,7 @@ class TestLock(greentest.TestCase): ...@@ -67,7 +67,7 @@ class TestLock(greentest.TestCase):
self.fail("Should have thrown an exception") self.fail("Should have thrown an exception")
except Exception as e: except Exception as e:
g_exc = e g_exc = e
self.assertTrue(isinstance(g_exc, type(std_exc)), (g_exc, std_exc)) self.assertIsInstance(g_exc, type(std_exc))
if __name__ == '__main__': if __name__ == '__main__':
......
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