mirror of
https://github.com/python/cpython.git
synced 2025-08-09 03:19:15 +00:00
[3.12] gh-110393: Remove watchdog with hardcoded timeout (GH-110400) (#110445)
gh-110393: Remove watchdog with hardcoded timeout (GH-110400)
test_builtin and test_socketserver no longer use signal.alarm() to
implement a watchdog with a hardcoded timeout (2 and 60 seconds).
Python test runner regrtest has two watchdogs: faulthandler and
timeout on running worker processes. Tests using short hardcoded
timeout can fail on slowest buildbots just because the timeout is too
short.
(cherry picked from commit 1328fa31fe
)
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
5a4e821b43
commit
1b58985077
2 changed files with 0 additions and 9 deletions
|
@ -2178,8 +2178,6 @@ class PtyTests(unittest.TestCase):
|
||||||
if pid == 0:
|
if pid == 0:
|
||||||
# Child
|
# Child
|
||||||
try:
|
try:
|
||||||
# Make sure we don't get stuck if there's a problem
|
|
||||||
signal.alarm(2)
|
|
||||||
os.close(r)
|
os.close(r)
|
||||||
with open(w, "w") as wpipe:
|
with open(w, "w") as wpipe:
|
||||||
child(wpipe)
|
child(wpipe)
|
||||||
|
|
|
@ -32,11 +32,6 @@ requires_unix_sockets = unittest.skipUnless(HAVE_UNIX_SOCKETS,
|
||||||
HAVE_FORKING = test.support.has_fork_support
|
HAVE_FORKING = test.support.has_fork_support
|
||||||
requires_forking = unittest.skipUnless(HAVE_FORKING, 'requires forking')
|
requires_forking = unittest.skipUnless(HAVE_FORKING, 'requires forking')
|
||||||
|
|
||||||
def signal_alarm(n):
|
|
||||||
"""Call signal.alarm when it exists (i.e. not on Windows)."""
|
|
||||||
if hasattr(signal, 'alarm'):
|
|
||||||
signal.alarm(n)
|
|
||||||
|
|
||||||
# Remember real select() to avoid interferences with mocking
|
# Remember real select() to avoid interferences with mocking
|
||||||
_real_select = select.select
|
_real_select = select.select
|
||||||
|
|
||||||
|
@ -68,12 +63,10 @@ class SocketServerTest(unittest.TestCase):
|
||||||
"""Test all socket servers."""
|
"""Test all socket servers."""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
signal_alarm(60) # Kill deadlocks after 60 seconds.
|
|
||||||
self.port_seed = 0
|
self.port_seed = 0
|
||||||
self.test_files = []
|
self.test_files = []
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
signal_alarm(0) # Didn't deadlock.
|
|
||||||
reap_children()
|
reap_children()
|
||||||
|
|
||||||
for fn in self.test_files:
|
for fn in self.test_files:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue