]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
test: Add a sleep to deflake a test
authorBen Darnell <ben@cockroachlabs.com>
Fri, 19 Jun 2020 18:36:36 +0000 (14:36 -0400)
committerBen Darnell <ben@cockroachlabs.com>
Fri, 19 Jun 2020 18:36:36 +0000 (14:36 -0400)
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.

tornado/test/process_test.py

index 4f2b1e63ac5fcfff8e32d6add71adf7edbf23229..1f299202481870dfe5c4aa8e648d97746c852ae1 100644 (file)
@@ -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)