Exemple #1
0
    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)
Exemple #2
0
    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)
Exemple #3
0
 def test_log_failure_success(self, _call):
     cmd = ("echo", "hello world")
     log_failure(cmd, "Saying hello")
     assert(was_called_with_cmd(_call, cmd))
Exemple #4
0
 def test_log_failure_success(self, _call):
     cmd = ("echo", "hello world")
     log_failure(cmd, "Saying hello")
     assert (was_called_with_cmd(_call, cmd))