def test_not_capture(self):
"""Test not capture."""
self.popen.returncode = 0
self.popen.communicate.return_value = (None, None)
self.assertEqual(
(0, None),
process.call('test', cwd='path', env={'NEW': '2'}, capture=False))
self.mock.Popen.assert_called_once_with(
'test', shell=True, cwd='path', env={'TEST': '1', 'NEW': '2'},
stdout=None, preexec_fn=os.setsid)
self.popen.communicate.assert_called_once_with()
self.mock.store_last_pid.assert_called_once_with(123)
self.assert_exact_calls(self.mock.kill_last_pid, [mock.call()] * 2)
self.mock.Thread.assert_called_once_with(
target=process.kill_when_timeout,
args=(self.popen, process.DEFAULT_TIMEOUT))
self.mock.Thread.return_value.start.assert_called_once_with()
评论列表
文章目录