def _test_returncode_helper(self, returncode, expected): start_name = 'oslo_rootwrap.wrapper.start_subprocess' with mock.patch(start_name) as mock_start: with mock.patch('sys.exit') as mock_exit: mock_start.return_value.wait.return_value = returncode cmd.run_one_command(None, mock.Mock(), None, None) mock_exit.assert_called_once_with(expected)
def _test_returncode_helper(self, returncode, expected): start_name = 'oslo_rootwrap.wrapper.start_subprocess' with mock.patch(start_name) as mock_start: with mock.patch('sys.exit') as mock_exit: mock_start.return_value.wait.return_value = returncode cmd.run_one_command(None, mock.Mock(), None, None) mock_exit.assert_called_once_with(expected)
def _test_returncode_helper(self, returncode, expected): with mock.patch.object(wrapper, "start_subprocess") as mock_start: with mock.patch("sys.exit") as mock_exit: mock_start.return_value.wait.return_value = returncode cmd.run_one_command(None, mock.Mock(), None, None) mock_exit.assert_called_once_with(expected)