Commit 5164f435 authored by Jason Madden's avatar Jason Madden Committed by GitHub

Merge pull request #1005 from gevent/issue1001

Update to PyPy3 5.8.0
parents a794c112 8dded1e6
......@@ -43,6 +43,9 @@
been tested. This merely removes the supporting Trove classifier and
remaining test code. See :issue:`997`.
- Linux CI now tests on PyPy3 3.5-5.8.0, updated from PyPy3 3.5-5.7.1.
See :issue:`1001`.
1.2.2 (2017-06-05)
==================
......
......@@ -110,7 +110,7 @@ PY34=$(BUILD_RUNTIMES)/snakepit/python3.4.5
PY35=$(BUILD_RUNTIMES)/snakepit/python3.5.3
PY36=$(BUILD_RUNTIMES)/snakepit/python3.6.0
PYPY=$(BUILD_RUNTIMES)/snakepit/pypy571
PYPY3=$(BUILD_RUNTIMES)/snakepit/pypy3.5_571
PYPY3=$(BUILD_RUNTIMES)/snakepit/pypy3.5_580
TOOLS=$(BUILD_RUNTIMES)/tools
......@@ -181,7 +181,7 @@ test-pypy: $(PYPY)
PYTHON=$(PYPY) PIP=pip PATH=$(BUILD_RUNTIMES)/versions/pypy571/bin:$(PATH) make develop toxtest
test-pypy3: $(PYPY3)
PYTHON=$(PYPY3) PIP=pip PATH=$(BUILD_RUNTIMES)/versions/pypy3.5_571/bin:$(PATH) make develop toxtest
PYTHON=$(PYPY3) PIP=pip PATH=$(BUILD_RUNTIMES)/versions/pypy3.5_580/bin:$(PATH) make develop toxtest
test-py27-cffi: $(PY27)
GEVENT_CORE_CFFI_ONLY=1 PYTHON=python2.7.13 PATH=$(BUILD_RUNTIMES)/versions/python2.7.13/bin:$(PATH) make develop toxtest
......
......@@ -106,7 +106,7 @@ for var in "$@"; do
install pypy2-5.7.1 pypy571
;;
pypy3)
install pypy3.5-5.7.1-beta pypy3.5_571
install pypy3.5-5.8.0 pypy3.5_580
;;
esac
done
......@@ -722,12 +722,12 @@ class GeneralModuleTests(unittest.TestCase):
s.sendto('\u2620', sockname)
self.assertIn(str(cm.exception),
["a bytes-like object is required, not 'str'", # cpython
"'str' does not support the buffer interface"]) # pypy
"a bytes-like object is required, not str"]) # pypy
with self.assertRaises(TypeError) as cm:
s.sendto(5j, sockname)
self.assertIn(str(cm.exception),
["a bytes-like object is required, not 'complex'",
"'complex' does not support the buffer interface"])
"a bytes-like object is required, not complex"])
with self.assertRaises(TypeError) as cm:
s.sendto(b'foo', None)
self.assertIn('NoneType', str(cm.exception))
......@@ -736,12 +736,12 @@ class GeneralModuleTests(unittest.TestCase):
s.sendto('\u2620', 0, sockname)
self.assertIn(str(cm.exception),
["a bytes-like object is required, not 'str'",
"'str' does not support the buffer interface"])
"a bytes-like object is required, not str"])
with self.assertRaises(TypeError) as cm:
s.sendto(5j, 0, sockname)
self.assertIn(str(cm.exception),
["a bytes-like object is required, not 'complex'",
"'complex' does not support the buffer interface"])
"a bytes-like object is required, not complex"])
with self.assertRaises(TypeError) as cm:
s.sendto(b'foo', 0, None)
self.assertIn('NoneType', str(cm.exception))
......
......@@ -118,7 +118,7 @@ else:
skipOnAppVeyor = _do_not_skip
if PYPY3 and RUNNING_ON_CI:
# Same as above, for PyPy3.3-5.5-alpha and 3.5-5.7.1-beta
# Same as above, for PyPy3.3-5.5-alpha and 3.5-5.7.1-beta and 3.5-5.8
skipOnPyPy3OnCI = unittest.skip
else:
skipOnPyPy3OnCI = _do_not_skip
......@@ -128,6 +128,11 @@ if PYPY:
else:
skipOnPyPy = _do_not_skip
if PYPY3:
skipOnPyPy3 = unittest.skip
else:
skipOnPyPy3 = _do_not_skip
EXPECT_POOR_TIMER_RESOLUTION = PYPY3 or RUNNING_ON_APPVEYOR
class ExpectedException(Exception):
......
......@@ -13,7 +13,6 @@ LEAKTEST = os.getenv('GEVENTTEST_LEAKCHECK')
COVERAGE = os.getenv("COVERAGE_PROCESS_START")
PYPY = hasattr(sys, 'pypy_version_info')
PY3 = sys.version_info[0] >= 3
PY26 = sys.version_info[0] == 2 and sys.version_info[1] == 6
PY27 = sys.version_info[0] == 2 and sys.version_info[1] == 7
PY35 = sys.version_info[0] >= 3 and sys.version_info[1] >= 5
PYGTE279 = (
......@@ -140,6 +139,10 @@ if PYPY:
## BUGS:
## UNKNOWN:
# AssertionError: '>>> ' != ''
# test__backdoor.py:52
'FLAKY test__backdoor.py',
]
if PY3 and TRAVIS:
......@@ -151,25 +154,6 @@ if PYPY:
]
if PY26:
FAILING_TESTS += [
# http://bugs.python.org/issue9446, fixed in 2.7/3
# https://github.com/python/cpython/commit/a104f91ff4c4560bec7c336afecb094e73a5ab7e
'FLAKY test_urllib2.py',
]
if TRAVIS:
# Started seeing this with a fresh build of 2.6.9
# on 2016-02-11. Can't reproduce locally.
# test__all__.test_ssl: items 'name', 'value' from
# stdlib module not found in gevent module.
# Which makes no sense. 2.6 isn't supported by python.org
# anymore, though, and we're starting to get warnings about
# pip.
FAILING_TESTS += [
'test__all__.py',
]
if PY3:
# No idea / TODO
FAILING_TESTS += [
......
......@@ -37,5 +37,5 @@ else:
with module_file:
module_source = module_file.read()
module_source = disable_tests_in_source(module_source, test_name)
module_code = compile(module_source, test_filename, 'exec')
module_code = compile(module_source, os.path.abspath(test_filename), 'exec')
exec(module_code, globals())
......@@ -6,9 +6,11 @@ import contextlib
import functools
import sys
import os
import platform
import re
TRAVIS = os.environ.get("TRAVIS") == "true"
OSX = bool(platform.mac_ver()[0])
# By default, test cases are expected to switch and emit warnings if there was none
# If a test is found in this list, it's expected not to switch.
......@@ -345,14 +347,6 @@ if hasattr(sys, 'pypy_version_info'):
# _execut_child)
]
import cffi # pylint:disable=import-error,useless-suppression
if cffi.__version_info__ < (1, 2, 0):
disabled_tests += [
'test_signal.InterProcessSignalTests.test_main',
# Fails to get the signal to the correct handler due to
# https://bitbucket.org/cffi/cffi/issue/152/handling-errors-from-signal-handlers-in
]
# Generic Python 3
if sys.version_info[0] == 3:
......@@ -443,32 +437,53 @@ if hasattr(sys, 'pypy_version_info') and sys.version_info[:2] >= (3, 3):
disabled_tests += [
# This raises 'RuntimeError: reentrant call' when exiting the
# process tries to close the stdout stream; no other platform does this.
# See in both 3.3 and 3.5
# Seen in both 3.3 and 3.5 (5.7 and 5.8)
'test_signal.SiginterruptTest.test_siginterrupt_off',
]
if hasattr(sys, 'pypy_version_info') and sys.pypy_version_info[:4] == (5, 7, 1, 'beta'): # pylint:disable=no-member
if hasattr(sys, 'pypy_version_info') and sys.pypy_version_info[:4] in ( # pylint:disable=no-member
(5, 8, 0, 'beta'),
):
# 3.5 is beta. Hard to say what are real bugs in us vs real bugs in pypy.
# For that reason, we pin these patches exactly to the version in use.
# TODO: Upgrade to v5.8.
disabled_tests += [
# This fails to close all the FDs, at least on CI. On OS X, many of the
# POSIXProcessTestCase fd tests have issues.
'test_subprocess.POSIXProcessTestCase.test_close_fds_when_max_fd_is_lowered',
# see extensive comments in this method. we don't actually disable it,
# we patched it.
# test_urllib2_localnet.TestUrlopen.test_https_with_cafile
# This has the wrong constants in 5.8 (but worked in 5.7), at least on
# OS X. It finds "zlib compression" but expects "ZLIB".
'test_ssl.ThreadedTests.test_compression',
]
if TRAVIS:
if OSX:
disabled_tests += [
# This seems to be a buffering issue? Something isn't getting flushed
# I can't reproduce locally though in Ubuntu 16 in a VM or a laptop with OS X.
'test_threading.ThreadJoinOnShutdown.test_2_join_in_forked_process',
'test_threading.ThreadJoinOnShutdown.test_1_join_in_forked_process',
# These all fail with "invalid_literal for int() with base 10: b''"
'test_subprocess.POSIXProcessTestCase.test_close_fds',
'test_subprocess.POSIXProcessTestCase.test_close_fds_after_preexec',
'test_subprocess.POSIXProcessTestCase.test_pass_fds',
'test_subprocess.POSIXProcessTestCase.test_pass_fds_inheritable',
'test_subprocess.POSIXProcessTestCase.test_pipe_cloexec',
]
disabled_tests += [
# This seems to be a buffering issue? Something isn't
# getting flushed. (The output is wrong). Under PyPy3 5.7,
# I couldn't reproduce locally in Ubuntu 16 in a VM
# or a laptop with OS X. Under 5.8.0, I can reproduce it, but only
# when run by the testrunner, not when run manually on the command line,
# so something is changing in stdout buffering in those situations.
'test_threading.ThreadJoinOnShutdown.test_2_join_in_forked_process',
'test_threading.ThreadJoinOnShutdown.test_1_join_in_forked_process',
]
if TRAVIS:
disabled_tests += [
# Likewise, but I haven't produced it locally.
'test_threading.ThreadJoinOnShutdown.test_1_join_on_shutdown',
]
wrapped_tests.update({
......
......@@ -84,7 +84,7 @@ class TestThread(threading.Thread):
self.nrunning.inc()
if verbose:
print(self.nrunning.get(), 'tasks are running')
self.testcase.assert_(self.nrunning.get() <= 3)
self.testcase.assertLessEqual(self.nrunning.get(), 3)
time.sleep(delay)
if verbose:
......@@ -92,7 +92,7 @@ class TestThread(threading.Thread):
with self.mutex:
self.nrunning.dec()
self.testcase.assert_(self.nrunning.get() >= 0)
self.testcase.assertGreaterEqual(self.nrunning.get(), 0)
if verbose:
print('%s is finished. %d tasks are running' % (
self.name, self.nrunning.get()))
......@@ -119,20 +119,20 @@ class ThreadTests(unittest.TestCase):
threads.append(t)
t.daemon = False # Under PYPY we get daemon by default?
if hasattr(t, 'ident'):
self.failUnlessEqual(t.ident, None)
self.assertIsNone(t.ident)
self.assertFalse(t.daemon)
self.assert_(re.match(r'<TestThread\(.*, initial\)>', repr(t)))
self.assertTrue(re.match(r'<TestThread\(.*, initial\)>', repr(t)))
t.start()
if verbose:
print('waiting for all tasks to complete')
for t in threads:
t.join(NUMTASKS)
self.assert_(not t.is_alive())
self.assertFalse(t.is_alive())
if hasattr(t, 'ident'):
self.failIfEqual(t.ident, 0)
self.assertNotEqual(t.ident, 0)
self.assertFalse(t.ident is None)
self.assert_(re.match(r'<TestThread\(.*, \w+ -?\d+\)>', repr(t)))
self.assertTrue(re.match(r'<TestThread\(.*, \w+ -?\d+\)>', repr(t)))
if verbose:
print('all tasks done')
self.assertEqual(numrunning.get(), 0)
......@@ -200,9 +200,9 @@ class ThreadTests(unittest.TestCase):
tid = thread.start_new_thread(f, (mutex,))
# Wait for the thread to finish.
mutex.acquire()
self.assert_(tid in threading._active)
self.assert_(isinstance(threading._active[tid],
threading._DummyThread))
self.assertIn(tid, threading._active)
self.assertIsInstance(threading._active[tid],
threading._DummyThread)
del threading._active[tid]
# in gevent, we actually clean up threading._active, but it's not happended there yet
......@@ -261,7 +261,7 @@ class ThreadTests(unittest.TestCase):
worker_started.wait()
if verbose:
print(" verifying worker hasn't exited")
self.assert_(not t.finished)
self.assertFalse(t.finished)
if verbose:
print(" attempting to raise asynch exception in worker")
result = set_async_exc(ctypes.c_long(t.id), exception)
......@@ -269,7 +269,7 @@ class ThreadTests(unittest.TestCase):
if verbose:
print(" waiting for worker to say it caught the exception")
worker_saw_exception.wait(timeout=10)
self.assert_(t.finished)
self.assertTrue(t.finished)
if verbose:
print(" all OK -- joining worker")
if t.finished:
......@@ -357,8 +357,8 @@ class ThreadTests(unittest.TestCase):
threading.Thread(target=child).start()
raise SystemExit
""" % setup_4],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
stdout, stderr = p.communicate()
stdout = stdout.strip()
stdout = stdout.decode('utf-8')
......@@ -382,7 +382,7 @@ class ThreadTests(unittest.TestCase):
t.join()
l = enum()
self.assertFalse(t in l,
"#1703448 triggered after %d trials: %s" % (i, l))
"#1703448 triggered after %d trials: %s" % (i, l))
finally:
sys.setcheckinterval(old_interval)
......@@ -406,7 +406,7 @@ class ThreadTests(unittest.TestCase):
weak_cyclic_object = weakref.ref(cyclic_object)
cyclic_object.thread.join()
del cyclic_object
self.assertEquals(None, weak_cyclic_object(),
self.assertIsNone(weak_cyclic_object(),
msg=('%d references still around' %
sys.getrefcount(weak_cyclic_object())))
......@@ -414,7 +414,7 @@ class ThreadTests(unittest.TestCase):
weak_raising_cyclic_object = weakref.ref(raising_cyclic_object)
raising_cyclic_object.thread.join()
del raising_cyclic_object
self.assertEquals(None, weak_raising_cyclic_object(),
self.assertIsNone(weak_raising_cyclic_object(),
msg=('%d references still around' %
sys.getrefcount(weak_raising_cyclic_object())))
......@@ -436,8 +436,8 @@ class ThreadJoinOnShutdown(unittest.TestCase):
rc = p.wait()
data = p.stdout.read().replace(b'\r', b'')
self.assertEqual(data, b"end of main\nend of thread\n")
self.failIf(rc == 2, b"interpreter was blocked")
self.failUnless(rc == 0, b"Unexpected error")
self.assertNotEqual(rc, 2, b"interpreter was blocked")
self.assertEqual(rc, 0, b"Unexpected error")
def test_1_join_on_shutdown(self):
# The usual case: on exit, wait for a non-daemon thread
......@@ -470,8 +470,7 @@ class ThreadJoinOnShutdown(unittest.TestCase):
"""
self._run_and_join(script)
@greentest.skipOnPyPy3OnCI("Sometimes has buffering issues")
# probably our bug? Need to flush something
@greentest.skipOnPyPy3("Buffering issue.")
def test_3_join_in_forked_from_thread(self):
# Like the test above, but fork() was called from a worker thread
# In the forked process, the main Thread object must be marked as stopped.
......@@ -502,6 +501,12 @@ class ThreadJoinOnShutdown(unittest.TestCase):
w = threading.Thread(target=worker)
w.start()
"""
# In PyPy3 5.8.0, if we don't wait on this top-level "thread", 'w',
# we never see "end of thread". It's not clear why, since that's being
# done in a child of this process. Yet in normal CPython 3, waiting on this
# causes the whole process to lock up (possibly because of some loop within
# the interpreter waiting on thread locks, like the issue described in threading.py
# for Python 3.4? in any case, it doesn't hang in Python 2.)
self._run_and_join(script)
......@@ -561,14 +566,15 @@ class BoundedSemaphoreTests(lock_tests.BoundedSemaphoreTests):
def main():
support.run_unittest(LockTests, RLockTests, EventTests,
ConditionAsRLockTests, ConditionTests,
SemaphoreTests, BoundedSemaphoreTests,
ThreadTests,
ThreadJoinOnShutdown,
ThreadingExceptionTests,
NativeRLockTests,
)
support.run_unittest(
LockTests, RLockTests, EventTests,
ConditionAsRLockTests, ConditionTests,
SemaphoreTests, BoundedSemaphoreTests,
ThreadTests,
ThreadJoinOnShutdown,
ThreadingExceptionTests,
NativeRLockTests,
)
if __name__ == "__main__":
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