test_twisted.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:maas 作者: maas 项目源码 文件源码
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())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号