test_twisted.py 文件源码

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

项目:maas 作者: maas 项目源码 文件源码
def test__terminates_with_kill_and_killpg(self):
        protocol = SignalPrinterProtocol()
        process = yield self.startSignalPrinter(protocol, pgrp=True)
        # 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 once then os.killpg was called twice because the
        # subprocess made itself a process group leader.
        self.assertThat(
            twisted_module._os_kill, MockCallsMatch(
                mock.call(pid, signal.SIGTERM),
            ))
        self.assertThat(
            twisted_module._os_killpg, MockCallsMatch(
                mock.call(pid, signal.SIGQUIT),
                mock.call(pid, signal.SIGKILL),
            ))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号