def test_return_code_raise_runtime_do_not_log_fail_as_error(self):
    self.mock_popen.return_value = ('', '')
    self.process.return_value.returncode = 1
    with mock.patch.object(utils, 'LOG') as log:
        self.assertRaises(RuntimeError, utils.execute, ['ls'], log_fail_as_error=False)
        self.assertFalse(log.error.called)
def test_return_code_raise_runtime_do_not_log_fail_as_error(self):
    self.mock_popen.return_value = (, )
    self.process.return_value.returncode = 1
    with mock.patch.object(utils, 'LOG') as log:
        self.assertRaises(RuntimeError, utils.execute, ['ls'], log_fail_as_error=False)
        self.assertFalse(log.error.called)