def test__terminates_with_kill_if_not_in_separate_process_group(self):
protocol = SignalPrinterProtocol()
process = yield self.startSignalPrinter(protocol, pgrp=False)
# Capture the pid now; it gets cleared when the process exits.
pid = process.pid
# Terminate and wait for it to exit.
self.terminateSignalPrinter(process, protocol)
yield protocol.done.addErrback(suppress, ProcessTerminated)
# os.kill was called 3 times because the subprocess did not make
# itself a process group leader.
self.assertThat(
twisted_module._os_kill, MockCallsMatch(
mock.call(pid, signal.SIGTERM),
mock.call(pid, signal.SIGQUIT),
mock.call(pid, signal.SIGKILL),
))
self.assertThat(
twisted_module._os_killpg, MockNotCalled())
评论列表
文章目录