mirror of
https://github.com/python/cpython.git
synced 2025-08-15 22:30:42 +00:00
[3.8] bpo-37531: Fix regrtest timeout for subprocesses (GH-15072) (GH-15279)
* bpo-37531: Fix regrtest timeout for subprocesses (GH-15072) Co-Authored-By: Joannah Nanjekye <joannah.nanjekye@ibm.com> (cherry picked from commitb0c8369c60
) * bpo-36511: Fix failures in Windows ARM32 buildbot (GH-15181) (cherry picked from commited70a344b5
) Backport also minor fixes from master (fix typo, remove importlib import).
This commit is contained in:
parent
984226962b
commit
d85c5670ff
7 changed files with 80 additions and 18 deletions
|
@ -1150,6 +1150,33 @@ class ArgsTestCase(BaseTestCase):
|
|||
env_changed=[testname],
|
||||
fail_env_changed=True)
|
||||
|
||||
def test_multiprocessing_timeout(self):
|
||||
code = textwrap.dedent(r"""
|
||||
import time
|
||||
import unittest
|
||||
try:
|
||||
import faulthandler
|
||||
except ImportError:
|
||||
faulthandler = None
|
||||
|
||||
class Tests(unittest.TestCase):
|
||||
# test hangs and so should be stopped by the timeout
|
||||
def test_sleep(self):
|
||||
# we want to test regrtest multiprocessing timeout,
|
||||
# not faulthandler timeout
|
||||
if faulthandler is not None:
|
||||
faulthandler.cancel_dump_traceback_later()
|
||||
|
||||
time.sleep(60 * 5)
|
||||
""")
|
||||
testname = self.create_test(code=code)
|
||||
|
||||
output = self.run_tests("-j2", "--timeout=1.0", testname, exitcode=2)
|
||||
self.check_executed_tests(output, [testname],
|
||||
failed=testname)
|
||||
self.assertRegex(output,
|
||||
re.compile('%s timed out' % testname, re.MULTILINE))
|
||||
|
||||
def test_cleanup(self):
|
||||
dirname = os.path.join(self.tmptestdir, "test_python_123")
|
||||
os.mkdir(dirname)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue