tests: terminate subprocess in test-stdio.py in case of exception
authorManuel Jacob <me@manueljacob.de>
Tue, 07 Jul 2020 12:35:29 +0200
changeset 45069 9172fd511999
parent 45068 8cd18aba5e6c
child 45070 bc05c13e246f
tests: terminate subprocess in test-stdio.py in case of exception If an error happened while reading the output of the subprocess, the pipe / TTY buffer can fill up and prevent that the subprocess ends. Therefore we should terminate the subprocess in case of an exception.
tests/test-stdio.py
--- a/tests/test-stdio.py	Tue Jul 07 11:06:37 2020 +0200
+++ b/tests/test-stdio.py	Tue Jul 07 12:35:29 2020 +0200
@@ -99,6 +99,9 @@
                 self.assertEqual(
                     _readall(stream_receiver, 1024), expected_output
                 )
+            except:  # re-raises
+                proc.terminate()
+                raise
             finally:
                 retcode = proc.wait()
             self.assertEqual(retcode, 0)