From 4361451694b8c001b9ebc8a9b6bbb3b997582b59 Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Sun, 26 Mar 2017 13:13:27 -0400 Subject: [PATCH] process_test: Report more details when test_sigchild_signal fails This test occasionally fails on pypy on travis-ci. --- tornado/test/process_test.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tornado/test/process_test.py b/tornado/test/process_test.py index 89e742e36..74c10abf1 100644 --- a/tornado/test/process_test.py +++ b/tornado/test/process_test.py @@ -219,10 +219,27 @@ class SubprocessTest(AsyncTestCase): self.addCleanup(Subprocess.uninitialize) subproc = Subprocess([sys.executable, '-c', 'import time; time.sleep(30)'], + stdout=Subprocess.STREAM, io_loop=self.io_loop) subproc.set_exit_callback(self.stop) os.kill(subproc.pid, signal.SIGTERM) - ret = self.wait() + try: + ret = self.wait(timeout=1.0) + except AssertionError: + # We failed to get the termination signal. This test is + # occasionally flaky on pypy, so try to get a little more + # information: did the process close its stdout + # (indicating that the problem is in the parent process's + # signal handling) or did the child process somehow fail + # to terminate? + subproc.stdout.read_until_close(callback=self.stop) + try: + self.wait(timeout=1.0) + except AssertionError: + raise AssertionError("subprocess failed to terminate") + else: + raise AssertionError("subprocess closed stdout but failed to " + "get termination signal") self.assertEqual(subproc.returncode, ret) self.assertEqual(ret, -signal.SIGTERM) -- 2.47.2