mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Try to make signal-sending tests in test_subprocess more robust on slow machines
This commit is contained in:
parent
fb8db8f635
commit
fedd481596
1 changed files with 4 additions and 2 deletions
|
@ -830,16 +830,18 @@ class POSIXProcessTestCase(BaseTestCase):
|
||||||
stdin=subprocess.PIPE, stderr=subprocess.PIPE)
|
stdin=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
|
||||||
# Let the process initialize (Issue #3137)
|
# Let the process initialize (Issue #3137)
|
||||||
time.sleep(0.1)
|
time.sleep(0.4)
|
||||||
# The process should not terminate prematurely
|
# The process should not terminate prematurely
|
||||||
self.assertIsNone(p.poll())
|
self.assertIsNone(p.poll())
|
||||||
# Retry if the process do not receive the signal.
|
# Retry if the process do not receive the signal.
|
||||||
count, maxcount = 0, 3
|
count, maxcount = 0, 10
|
||||||
while count < maxcount and p.poll() is None:
|
while count < maxcount and p.poll() is None:
|
||||||
getattr(p, method)(*args)
|
getattr(p, method)(*args)
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
count += 1
|
count += 1
|
||||||
|
|
||||||
|
if count == maxcount:
|
||||||
|
self.skipTest("apparently failed to send the signal")
|
||||||
self.assertIsNotNone(p.poll(), "the subprocess did not terminate")
|
self.assertIsNotNone(p.poll(), "the subprocess did not terminate")
|
||||||
if count > 1:
|
if count > 1:
|
||||||
print("p.{}{} succeeded after "
|
print("p.{}{} succeeded after "
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue