Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
5164f435
Commit
5164f435
authored
Jul 21, 2017
by
Jason Madden
Committed by
GitHub
Jul 21, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1005 from gevent/issue1001
Update to PyPy3 5.8.0
parents
a794c112
8dded1e6
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
90 additions
and
77 deletions
+90
-77
CHANGES.rst
CHANGES.rst
+3
-0
Makefile
Makefile
+2
-2
scripts/install.sh
scripts/install.sh
+1
-1
src/greentest/3.5pypy/test_socket.py
src/greentest/3.5pypy/test_socket.py
+4
-4
src/greentest/greentest.py
src/greentest/greentest.py
+6
-1
src/greentest/known_failures.py
src/greentest/known_failures.py
+4
-20
src/greentest/monkey_test.py
src/greentest/monkey_test.py
+1
-1
src/greentest/patched_tests_setup.py
src/greentest/patched_tests_setup.py
+34
-19
src/greentest/test_threading_2.py
src/greentest/test_threading_2.py
+35
-29
No files found.
CHANGES.rst
View file @
5164f435
...
@@ -43,6 +43,9 @@
...
@@ -43,6 +43,9 @@
been tested. This merely removes the supporting Trove classifier and
been tested. This merely removes the supporting Trove classifier and
remaining test code. See :issue:`997`.
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)
1.2.2 (2017-06-05)
==================
==================
...
...
Makefile
View file @
5164f435
...
@@ -110,7 +110,7 @@ PY34=$(BUILD_RUNTIMES)/snakepit/python3.4.5
...
@@ -110,7 +110,7 @@ PY34=$(BUILD_RUNTIMES)/snakepit/python3.4.5
PY35
=
$(BUILD_RUNTIMES)
/snakepit/python3.5.3
PY35
=
$(BUILD_RUNTIMES)
/snakepit/python3.5.3
PY36
=
$(BUILD_RUNTIMES)
/snakepit/python3.6.0
PY36
=
$(BUILD_RUNTIMES)
/snakepit/python3.6.0
PYPY
=
$(BUILD_RUNTIMES)
/snakepit/pypy571
PYPY
=
$(BUILD_RUNTIMES)
/snakepit/pypy571
PYPY3
=
$(BUILD_RUNTIMES)
/snakepit/pypy3.5_5
71
PYPY3
=
$(BUILD_RUNTIMES)
/snakepit/pypy3.5_5
80
TOOLS
=
$(BUILD_RUNTIMES)
/tools
TOOLS
=
$(BUILD_RUNTIMES)
/tools
...
@@ -181,7 +181,7 @@ test-pypy: $(PYPY)
...
@@ -181,7 +181,7 @@ test-pypy: $(PYPY)
PYTHON
=
$(PYPY)
PIP
=
pip
PATH
=
$(BUILD_RUNTIMES)
/versions/pypy571/bin:
$(PATH)
make develop toxtest
PYTHON
=
$(PYPY)
PIP
=
pip
PATH
=
$(BUILD_RUNTIMES)
/versions/pypy571/bin:
$(PATH)
make develop toxtest
test-pypy3
:
$(PYPY3)
test-pypy3
:
$(PYPY3)
PYTHON
=
$(PYPY3)
PIP
=
pip
PATH
=
$(BUILD_RUNTIMES)
/versions/pypy3.5_5
71
/bin:
$(PATH)
make develop toxtest
PYTHON
=
$(PYPY3)
PIP
=
pip
PATH
=
$(BUILD_RUNTIMES)
/versions/pypy3.5_5
80
/bin:
$(PATH)
make develop toxtest
test-py27-cffi
:
$(PY27)
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
GEVENT_CORE_CFFI_ONLY
=
1
PYTHON
=
python2.7.13
PATH
=
$(BUILD_RUNTIMES)
/versions/python2.7.13/bin:
$(PATH)
make develop toxtest
...
...
scripts/install.sh
View file @
5164f435
...
@@ -106,7 +106,7 @@ for var in "$@"; do
...
@@ -106,7 +106,7 @@ for var in "$@"; do
install
pypy2-5.7.1 pypy571
install
pypy2-5.7.1 pypy571
;;
;;
pypy3
)
pypy3
)
install
pypy3.5-5.
7.1-beta pypy3.5_571
install
pypy3.5-5.
8.0 pypy3.5_580
;;
;;
esac
esac
done
done
src/greentest/3.5pypy/test_socket.py
View file @
5164f435
...
@@ -722,12 +722,12 @@ class GeneralModuleTests(unittest.TestCase):
...
@@ -722,12 +722,12 @@ class GeneralModuleTests(unittest.TestCase):
s
.
sendto
(
'
\
u2620
'
,
sockname
)
s
.
sendto
(
'
\
u2620
'
,
sockname
)
self
.
assertIn
(
str
(
cm
.
exception
),
self
.
assertIn
(
str
(
cm
.
exception
),
[
"a bytes-like object is required, not 'str'"
,
# cpython
[
"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
:
with
self
.
assertRaises
(
TypeError
)
as
cm
:
s
.
sendto
(
5j
,
sockname
)
s
.
sendto
(
5j
,
sockname
)
self
.
assertIn
(
str
(
cm
.
exception
),
self
.
assertIn
(
str
(
cm
.
exception
),
[
"a bytes-like object is required, not 'complex'"
,
[
"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
:
with
self
.
assertRaises
(
TypeError
)
as
cm
:
s
.
sendto
(
b'foo'
,
None
)
s
.
sendto
(
b'foo'
,
None
)
self
.
assertIn
(
'NoneType'
,
str
(
cm
.
exception
))
self
.
assertIn
(
'NoneType'
,
str
(
cm
.
exception
))
...
@@ -736,12 +736,12 @@ class GeneralModuleTests(unittest.TestCase):
...
@@ -736,12 +736,12 @@ class GeneralModuleTests(unittest.TestCase):
s
.
sendto
(
'
\
u2620
'
,
0
,
sockname
)
s
.
sendto
(
'
\
u2620
'
,
0
,
sockname
)
self
.
assertIn
(
str
(
cm
.
exception
),
self
.
assertIn
(
str
(
cm
.
exception
),
[
"a bytes-like object is required, not 'str'"
,
[
"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
:
with
self
.
assertRaises
(
TypeError
)
as
cm
:
s
.
sendto
(
5j
,
0
,
sockname
)
s
.
sendto
(
5j
,
0
,
sockname
)
self
.
assertIn
(
str
(
cm
.
exception
),
self
.
assertIn
(
str
(
cm
.
exception
),
[
"a bytes-like object is required, not 'complex'"
,
[
"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
:
with
self
.
assertRaises
(
TypeError
)
as
cm
:
s
.
sendto
(
b'foo'
,
0
,
None
)
s
.
sendto
(
b'foo'
,
0
,
None
)
self
.
assertIn
(
'NoneType'
,
str
(
cm
.
exception
))
self
.
assertIn
(
'NoneType'
,
str
(
cm
.
exception
))
...
...
src/greentest/greentest.py
View file @
5164f435
...
@@ -118,7 +118,7 @@ else:
...
@@ -118,7 +118,7 @@ else:
skipOnAppVeyor
=
_do_not_skip
skipOnAppVeyor
=
_do_not_skip
if
PYPY3
and
RUNNING_ON_CI
:
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
skipOnPyPy3OnCI
=
unittest
.
skip
else
:
else
:
skipOnPyPy3OnCI
=
_do_not_skip
skipOnPyPy3OnCI
=
_do_not_skip
...
@@ -128,6 +128,11 @@ if PYPY:
...
@@ -128,6 +128,11 @@ if PYPY:
else
:
else
:
skipOnPyPy
=
_do_not_skip
skipOnPyPy
=
_do_not_skip
if
PYPY3
:
skipOnPyPy3
=
unittest
.
skip
else
:
skipOnPyPy3
=
_do_not_skip
EXPECT_POOR_TIMER_RESOLUTION
=
PYPY3
or
RUNNING_ON_APPVEYOR
EXPECT_POOR_TIMER_RESOLUTION
=
PYPY3
or
RUNNING_ON_APPVEYOR
class
ExpectedException
(
Exception
):
class
ExpectedException
(
Exception
):
...
...
src/greentest/known_failures.py
View file @
5164f435
...
@@ -13,7 +13,6 @@ LEAKTEST = os.getenv('GEVENTTEST_LEAKCHECK')
...
@@ -13,7 +13,6 @@ LEAKTEST = os.getenv('GEVENTTEST_LEAKCHECK')
COVERAGE
=
os
.
getenv
(
"COVERAGE_PROCESS_START"
)
COVERAGE
=
os
.
getenv
(
"COVERAGE_PROCESS_START"
)
PYPY
=
hasattr
(
sys
,
'pypy_version_info'
)
PYPY
=
hasattr
(
sys
,
'pypy_version_info'
)
PY3
=
sys
.
version_info
[
0
]
>=
3
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
PY27
=
sys
.
version_info
[
0
]
==
2
and
sys
.
version_info
[
1
]
==
7
PY35
=
sys
.
version_info
[
0
]
>=
3
and
sys
.
version_info
[
1
]
>=
5
PY35
=
sys
.
version_info
[
0
]
>=
3
and
sys
.
version_info
[
1
]
>=
5
PYGTE279
=
(
PYGTE279
=
(
...
@@ -140,6 +139,10 @@ if PYPY:
...
@@ -140,6 +139,10 @@ if PYPY:
## BUGS:
## BUGS:
## UNKNOWN:
# AssertionError: '>>> ' != ''
# test__backdoor.py:52
'FLAKY test__backdoor.py'
,
]
]
if
PY3
and
TRAVIS
:
if
PY3
and
TRAVIS
:
...
@@ -151,25 +154,6 @@ if PYPY:
...
@@ -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
:
if
PY3
:
# No idea / TODO
# No idea / TODO
FAILING_TESTS
+=
[
FAILING_TESTS
+=
[
...
...
src/greentest/monkey_test.py
View file @
5164f435
...
@@ -37,5 +37,5 @@ else:
...
@@ -37,5 +37,5 @@ else:
with
module_file
:
with
module_file
:
module_source
=
module_file
.
read
()
module_source
=
module_file
.
read
()
module_source
=
disable_tests_in_source
(
module_source
,
test_name
)
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
())
exec
(
module_code
,
globals
())
src/greentest/patched_tests_setup.py
View file @
5164f435
...
@@ -6,9 +6,11 @@ import contextlib
...
@@ -6,9 +6,11 @@ import contextlib
import
functools
import
functools
import
sys
import
sys
import
os
import
os
import
platform
import
re
import
re
TRAVIS
=
os
.
environ
.
get
(
"TRAVIS"
)
==
"true"
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
# 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.
# If a test is found in this list, it's expected not to switch.
...
@@ -345,14 +347,6 @@ if hasattr(sys, 'pypy_version_info'):
...
@@ -345,14 +347,6 @@ if hasattr(sys, 'pypy_version_info'):
# _execut_child)
# _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
# Generic Python 3
if
sys
.
version_info
[
0
]
==
3
:
if
sys
.
version_info
[
0
]
==
3
:
...
@@ -443,32 +437,53 @@ if hasattr(sys, 'pypy_version_info') and sys.version_info[:2] >= (3, 3):
...
@@ -443,32 +437,53 @@ if hasattr(sys, 'pypy_version_info') and sys.version_info[:2] >= (3, 3):
disabled_tests
+=
[
disabled_tests
+=
[
# This raises 'RuntimeError: reentrant call' when exiting the
# This raises 'RuntimeError: reentrant call' when exiting the
# process tries to close the stdout stream; no other platform does this.
# process tries to close the stdout stream; no other platform does this.
# See
in both 3.3 and 3.5
# See
n in both 3.3 and 3.5 (5.7 and 5.8)
'test_signal.SiginterruptTest.test_siginterrupt_off'
,
'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.
# 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.
# For that reason, we pin these patches exactly to the version in use.
# TODO: Upgrade to v5.8.
disabled_tests
+=
[
disabled_tests
+=
[
# This fails to close all the FDs, at least on CI. On OS X, many of the
# This fails to close all the FDs, at least on CI. On OS X, many of the
# POSIXProcessTestCase fd tests have issues.
# POSIXProcessTestCase fd tests have issues.
'test_subprocess.POSIXProcessTestCase.test_close_fds_when_max_fd_is_lowered'
,
'test_subprocess.POSIXProcessTestCase.test_close_fds_when_max_fd_is_lowered'
,
#
see extensive comments in this method. we don't actually disable it,
#
This has the wrong constants in 5.8 (but worked in 5.7), at least on
#
we patched it
.
#
OS X. It finds "zlib compression" but expects "ZLIB"
.
# test_urllib2_localnet.TestUrlopen.test_https_with_cafile
'test_ssl.ThreadedTests.test_compression'
,
]
]
if
TRAVIS
:
if
OSX
:
disabled_tests
+=
[
disabled_tests
+=
[
# This seems to be a buffering issue? Something isn't getting flushed
# These all fail with "invalid_literal for int() with base 10: b''"
# I can't reproduce locally though in Ubuntu 16 in a VM or a laptop with OS X.
'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_2_join_in_forked_process'
,
'test_threading.ThreadJoinOnShutdown.test_1_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
({
wrapped_tests
.
update
({
...
...
src/greentest/test_threading_2.py
View file @
5164f435
...
@@ -84,7 +84,7 @@ class TestThread(threading.Thread):
...
@@ -84,7 +84,7 @@ class TestThread(threading.Thread):
self
.
nrunning
.
inc
()
self
.
nrunning
.
inc
()
if
verbose
:
if
verbose
:
print
(
self
.
nrunning
.
get
(),
'tasks are running'
)
print
(
self
.
nrunning
.
get
(),
'tasks are running'
)
self
.
testcase
.
assert
_
(
self
.
nrunning
.
get
()
<=
3
)
self
.
testcase
.
assert
LessEqual
(
self
.
nrunning
.
get
(),
3
)
time
.
sleep
(
delay
)
time
.
sleep
(
delay
)
if
verbose
:
if
verbose
:
...
@@ -92,7 +92,7 @@ class TestThread(threading.Thread):
...
@@ -92,7 +92,7 @@ class TestThread(threading.Thread):
with
self
.
mutex
:
with
self
.
mutex
:
self
.
nrunning
.
dec
()
self
.
nrunning
.
dec
()
self
.
testcase
.
assert
_
(
self
.
nrunning
.
get
()
>=
0
)
self
.
testcase
.
assert
GreaterEqual
(
self
.
nrunning
.
get
(),
0
)
if
verbose
:
if
verbose
:
print
(
'%s is finished. %d tasks are running'
%
(
print
(
'%s is finished. %d tasks are running'
%
(
self
.
name
,
self
.
nrunning
.
get
()))
self
.
name
,
self
.
nrunning
.
get
()))
...
@@ -119,20 +119,20 @@ class ThreadTests(unittest.TestCase):
...
@@ -119,20 +119,20 @@ class ThreadTests(unittest.TestCase):
threads
.
append
(
t
)
threads
.
append
(
t
)
t
.
daemon
=
False
# Under PYPY we get daemon by default?
t
.
daemon
=
False
# Under PYPY we get daemon by default?
if
hasattr
(
t
,
'ident'
):
if
hasattr
(
t
,
'ident'
):
self
.
failUnlessEqual
(
t
.
ident
,
None
)
self
.
assertIsNone
(
t
.
ident
)
self
.
assertFalse
(
t
.
daemon
)
self
.
assertFalse
(
t
.
daemon
)
self
.
assert
_
(
re
.
match
(
r'<TestThread\
(.*, i
nitial\
)>
', repr(t)))
self
.
assert
True
(
re
.
match
(
r'<TestThread\
(.*, i
nitial\
)>
', repr(t)))
t.start()
t.start()
if verbose:
if verbose:
print('
waiting
for
all
tasks
to
complete
')
print('
waiting
for
all
tasks
to
complete
')
for t in threads:
for t in threads:
t.join(NUMTASKS)
t.join(NUMTASKS)
self.assert
_(not
t.is_alive())
self.assert
False(
t.is_alive())
if hasattr(t, '
ident
'):
if hasattr(t, '
ident
'):
self.
failIf
Equal(t.ident, 0)
self.
assertNot
Equal(t.ident, 0)
self.assertFalse(t.ident is None)
self.assertFalse(t.ident is None)
self.assert
_
(re.match(r'
<
TestThread
\
(.
*
,
\
w
+
-
?
\
d
+
\
)
>
', repr(t)))
self.assert
True
(re.match(r'
<
TestThread
\
(.
*
,
\
w
+
-
?
\
d
+
\
)
>
', repr(t)))
if verbose:
if verbose:
print('
all
tasks
done
')
print('
all
tasks
done
')
self.assertEqual(numrunning.get(), 0)
self.assertEqual(numrunning.get(), 0)
...
@@ -200,9 +200,9 @@ class ThreadTests(unittest.TestCase):
...
@@ -200,9 +200,9 @@ class ThreadTests(unittest.TestCase):
tid = thread.start_new_thread(f, (mutex,))
tid = thread.start_new_thread(f, (mutex,))
# Wait for the thread to finish.
# Wait for the thread to finish.
mutex.acquire()
mutex.acquire()
self.assert
_(tid in
threading._active)
self.assert
In(tid,
threading._active)
self.assert
_(isi
nstance(threading._active[tid],
self.assert
IsI
nstance(threading._active[tid],
threading._DummyThread)
)
threading._DummyThread
)
del threading._active[tid]
del threading._active[tid]
# in gevent, we actually clean up threading._active, but it'
s
not
happended
there
yet
# in gevent, we actually clean up threading._active, but it'
s
not
happended
there
yet
...
@@ -261,7 +261,7 @@ class ThreadTests(unittest.TestCase):
...
@@ -261,7 +261,7 @@ class ThreadTests(unittest.TestCase):
worker_started
.
wait
()
worker_started
.
wait
()
if
verbose
:
if
verbose
:
print
(
" verifying worker hasn't exited"
)
print
(
" verifying worker hasn't exited"
)
self
.
assert
_
(
not
t
.
finished
)
self
.
assert
False
(
t
.
finished
)
if
verbose
:
if
verbose
:
print
(
" attempting to raise asynch exception in worker"
)
print
(
" attempting to raise asynch exception in worker"
)
result
=
set_async_exc
(
ctypes
.
c_long
(
t
.
id
),
exception
)
result
=
set_async_exc
(
ctypes
.
c_long
(
t
.
id
),
exception
)
...
@@ -269,7 +269,7 @@ class ThreadTests(unittest.TestCase):
...
@@ -269,7 +269,7 @@ class ThreadTests(unittest.TestCase):
if
verbose
:
if
verbose
:
print
(
" waiting for worker to say it caught the exception"
)
print
(
" waiting for worker to say it caught the exception"
)
worker_saw_exception
.
wait
(
timeout
=
10
)
worker_saw_exception
.
wait
(
timeout
=
10
)
self
.
assert
_
(
t
.
finished
)
self
.
assert
True
(
t
.
finished
)
if
verbose
:
if
verbose
:
print
(
" all OK -- joining worker"
)
print
(
" all OK -- joining worker"
)
if
t
.
finished
:
if
t
.
finished
:
...
@@ -406,7 +406,7 @@ class ThreadTests(unittest.TestCase):
...
@@ -406,7 +406,7 @@ class ThreadTests(unittest.TestCase):
weak_cyclic_object
=
weakref
.
ref
(
cyclic_object
)
weak_cyclic_object
=
weakref
.
ref
(
cyclic_object
)
cyclic_object
.
thread
.
join
()
cyclic_object
.
thread
.
join
()
del
cyclic_object
del
cyclic_object
self
.
assert
Equals
(
None
,
weak_cyclic_object
(),
self
.
assert
IsNone
(
weak_cyclic_object
(),
msg
=
(
'%d references still around'
%
msg
=
(
'%d references still around'
%
sys
.
getrefcount
(
weak_cyclic_object
())))
sys
.
getrefcount
(
weak_cyclic_object
())))
...
@@ -414,7 +414,7 @@ class ThreadTests(unittest.TestCase):
...
@@ -414,7 +414,7 @@ class ThreadTests(unittest.TestCase):
weak_raising_cyclic_object
=
weakref
.
ref
(
raising_cyclic_object
)
weak_raising_cyclic_object
=
weakref
.
ref
(
raising_cyclic_object
)
raising_cyclic_object
.
thread
.
join
()
raising_cyclic_object
.
thread
.
join
()
del
raising_cyclic_object
del
raising_cyclic_object
self
.
assert
Equals
(
None
,
weak_raising_cyclic_object
(),
self
.
assert
IsNone
(
weak_raising_cyclic_object
(),
msg
=
(
'%d references still around'
%
msg
=
(
'%d references still around'
%
sys
.
getrefcount
(
weak_raising_cyclic_object
())))
sys
.
getrefcount
(
weak_raising_cyclic_object
())))
...
@@ -436,8 +436,8 @@ class ThreadJoinOnShutdown(unittest.TestCase):
...
@@ -436,8 +436,8 @@ class ThreadJoinOnShutdown(unittest.TestCase):
rc
=
p
.
wait
()
rc
=
p
.
wait
()
data
=
p
.
stdout
.
read
().
replace
(
b'
\
r
'
,
b''
)
data
=
p
.
stdout
.
read
().
replace
(
b'
\
r
'
,
b''
)
self
.
assertEqual
(
data
,
b"end of main
\
n
end of thread
\
n
"
)
self
.
assertEqual
(
data
,
b"end of main
\
n
end of thread
\
n
"
)
self
.
failIf
(
rc
==
2
,
b"interpreter was blocked"
)
self
.
assertNotEqual
(
rc
,
2
,
b"interpreter was blocked"
)
self
.
failUnless
(
rc
==
0
,
b"Unexpected error"
)
self
.
assertEqual
(
rc
,
0
,
b"Unexpected error"
)
def
test_1_join_on_shutdown
(
self
):
def
test_1_join_on_shutdown
(
self
):
# The usual case: on exit, wait for a non-daemon thread
# The usual case: on exit, wait for a non-daemon thread
...
@@ -470,8 +470,7 @@ class ThreadJoinOnShutdown(unittest.TestCase):
...
@@ -470,8 +470,7 @@ class ThreadJoinOnShutdown(unittest.TestCase):
"""
"""
self
.
_run_and_join
(
script
)
self
.
_run_and_join
(
script
)
@
greentest
.
skipOnPyPy3OnCI
(
"Sometimes has buffering issues"
)
@
greentest
.
skipOnPyPy3
(
"Buffering issue."
)
# probably our bug? Need to flush something
def
test_3_join_in_forked_from_thread
(
self
):
def
test_3_join_in_forked_from_thread
(
self
):
# Like the test above, but fork() was called from a worker thread
# 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.
# In the forked process, the main Thread object must be marked as stopped.
...
@@ -502,6 +501,12 @@ class ThreadJoinOnShutdown(unittest.TestCase):
...
@@ -502,6 +501,12 @@ class ThreadJoinOnShutdown(unittest.TestCase):
w = threading.Thread(target=worker)
w = threading.Thread(target=worker)
w.start()
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
)
self
.
_run_and_join
(
script
)
...
@@ -561,7 +566,8 @@ class BoundedSemaphoreTests(lock_tests.BoundedSemaphoreTests):
...
@@ -561,7 +566,8 @@ class BoundedSemaphoreTests(lock_tests.BoundedSemaphoreTests):
def
main
():
def
main
():
support
.
run_unittest
(
LockTests
,
RLockTests
,
EventTests
,
support
.
run_unittest
(
LockTests
,
RLockTests
,
EventTests
,
ConditionAsRLockTests
,
ConditionTests
,
ConditionAsRLockTests
,
ConditionTests
,
SemaphoreTests
,
BoundedSemaphoreTests
,
SemaphoreTests
,
BoundedSemaphoreTests
,
ThreadTests
,
ThreadTests
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment