def test_log_failure_failure(self): # Throws OSError cmd = ("/invalid/cmd", "hello world") self.assertFalse(log_failure(cmd, "Saying hello")) with self.assertRaises(CommandFailure): log_failure(cmd, "Failing", fatal=True) cmd = ("false",) self.assertFalse(log_failure(cmd, "Failing")) with self.assertRaises(CommandFailure): log_failure(cmd, "Failing", fatal=True)
def test_log_failure_failure(self): # Throws OSError cmd = ("/invalid/cmd", "hello world") self.assertFalse(log_failure(cmd, "Saying hello")) with self.assertRaises(CommandFailure): log_failure(cmd, "Failing", fatal=True) cmd = ("false", ) self.assertFalse(log_failure(cmd, "Failing")) with self.assertRaises(CommandFailure): log_failure(cmd, "Failing", fatal=True)
def test_log_failure_success(self, _call): cmd = ("echo", "hello world") log_failure(cmd, "Saying hello") assert(was_called_with_cmd(_call, cmd))
def test_log_failure_success(self, _call): cmd = ("echo", "hello world") log_failure(cmd, "Saying hello") assert (was_called_with_cmd(_call, cmd))