comparison tests/test-stdio.py @ 45069:9172fd511999

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.
author Manuel Jacob <me@manueljacob.de>
date Tue, 07 Jul 2020 12:35:29 +0200
parents 8cd18aba5e6c
children bc05c13e246f
comparison
equal deleted inserted replaced
45068:8cd18aba5e6c 45069:9172fd511999
97 try: 97 try:
98 os.close(child_stream) 98 os.close(child_stream)
99 self.assertEqual( 99 self.assertEqual(
100 _readall(stream_receiver, 1024), expected_output 100 _readall(stream_receiver, 1024), expected_output
101 ) 101 )
102 except: # re-raises
103 proc.terminate()
104 raise
102 finally: 105 finally:
103 retcode = proc.wait() 106 retcode = proc.wait()
104 self.assertEqual(retcode, 0) 107 self.assertEqual(retcode, 0)
105 108
106 def test_stdout_pipes(self): 109 def test_stdout_pipes(self):