示例#1
0
 def test_wait_timeout(self):
     # Ensure that wait() honors its "timeout" argument.
     proc = Process()
     proc.spawn(['sleep', '10'])
     self.assertRaises(Timeout, proc.wait, 0.1)
     proc.terminate()
     proc.wait()
     proc.close()
示例#2
0
 def test_wait_timeout(self):
     # Ensure that wait() honors its "timeout" argument.
     proc = Process()
     proc.spawn(['sleep', '10'])
     self.assertRaises(Timeout, proc.wait, 0.1)
     proc.terminate()
     proc.wait()
     proc.close()
示例#3
0
 def test_communicate_timeout(self):
     # Test that communicate() honors its "timeout" argument
     proc = Process()
     proc.spawn(['sleep', '10'], stdin=PIPE, stdout=PIPE)
     buf = b'x' * 1024
     self.assertRaises(Timeout, proc.communicate, buf, timeout=0.1)
     proc.terminate()
     proc.wait()
     proc.close()
示例#4
0
 def test_terminate(self):
     # Ensure that terminate() kills our child.
     proc = Process()
     proc.spawn(['sleep', '1'])
     proc.terminate()
     proc.wait()
     self.assertEqual(proc.returncode, -signal.SIGTERM)
     proc.terminate()  # should not error
     proc.close()
示例#5
0
 def test_communicate_timeout(self):
     # Test that communicate() honors its "timeout" argument
     proc = Process()
     proc.spawn(['sleep', '10'], stdin=PIPE, stdout=PIPE)
     buf = b'x' * 1024
     self.assertRaises(Timeout, proc.communicate, buf, timeout=0.1)
     proc.terminate()
     proc.wait()
     proc.close()
示例#6
0
 def test_terminate(self):
     # Ensure that terminate() kills our child.
     proc = Process()
     proc.spawn(['sleep', '1'])
     proc.terminate()
     proc.wait()
     self.assertEqual(proc.returncode, -signal.SIGTERM)
     proc.terminate()  # should not error
     proc.close()