def run_test(self, command, issued_commands, environ): calls = [] for cmd in issued_commands: calls.append(call(cmd.split(' '), env=environ, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=1)) subprocess.Popen = MagicMock() with patch.object(sys, 'argv', command.split(' ')): main.main() for called, expect in zip(subprocess.Popen.call_args_list, calls): self.assertEqual(called, expect)
def run_test(self, command, issued_commands, environ): calls = [] for cmd in issued_commands: calls.append(call(cmd.split(' '), env=environ, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=1)) subprocess.Popen = MagicMock() with patch.object(sys, 'argv', command.split(' ')): main.main() for called, expect in zip(subprocess.Popen.call_args_list, calls): self.assertEqual(called, expect)