From: Ben Darnell Date: Fri, 19 Jun 2020 18:36:36 +0000 (-0400) Subject: test: Add a sleep to deflake a test X-Git-Tag: v6.1.0b1~26^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ce734903269745133bcfe7e48fad55fe2a02931;p=thirdparty%2Ftornado.git test: Add a sleep to deflake a test Not sure why this has recently started happening in some environments, but killing a process too soon causes the wrong exit status in some python builds on macOS. --- diff --git a/tornado/test/process_test.py b/tornado/test/process_test.py index 4f2b1e63a..1f2992024 100644 --- a/tornado/test/process_test.py +++ b/tornado/test/process_test.py @@ -4,6 +4,7 @@ import os import signal import subprocess import sys +import time import unittest from tornado.httpclient import HTTPClient, HTTPError @@ -224,6 +225,14 @@ class SubprocessTest(AsyncTestCase): ) self.addCleanup(subproc.stdout.close) subproc.set_exit_callback(self.stop) + + # For unclear reasons, killing a process too soon after + # creating it can result in an exit status corresponding to + # SIGKILL instead of the actual signal involved. This has been + # observed on macOS 10.15 with Python 3.8 installed via brew, + # but not with the system-installed Python 3.7. + time.sleep(0.1) + os.kill(subproc.pid, signal.SIGTERM) try: ret = self.wait(timeout=1.0)