示例#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)
示例#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)
示例#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))
示例#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))