[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 commit b0c8369c60)

* bpo-36511: Fix failures in Windows ARM32 buildbot (GH-15181)

(cherry picked from commit ed70a344b5)

Backport also minor fixes from master (fix typo, remove importlib import).
This commit is contained in:
Victor Stinner 2019-08-14 16:31:32 +02:00 committed by GitHub
parent 984226962b
commit d85c5670ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 80 additions and 18 deletions

View file

@ -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)