Example #1
0
 def test_MonitorSkip(self):
     m = Monitor()
     m.record_skip("a")
     self.assertEqual(m.get_success_count(), 1, "Success count is not 1")
     self.assertTrue(m.was_skipped, "was_skipped is not true")
     self.assertEqual(m.skip_dep, "a", "skip_dep is not correct")
     self.assertTrue(m.skipped(), "skipped() is not true")
Example #2
0
 def test_MonitorSkip(self):
     m = Monitor()
     m.record_skip("a")
     self.assertEqual(m.get_success_count(), 1, "Success count is not 1")
     self.assertTrue(m.was_skipped, "was_skipped is not true")
     self.assertEqual(m.skip_dep, "a", "skip_dep is not correct")
     self.assertTrue(m.skipped(), "skipped() is not true")
     self.assertEqual(m.state(), MonitorState.SKIPPED,
                      "monitor did not report state correctly")
Example #3
0
 def test_MonitorSuccess(self):
     m = Monitor()
     m.record_success("yay")
     self.assertEqual(m.error_count, 0, "Error count is not 0")
     self.assertEqual(m.get_success_count(), 1, "Success count is not 1")
     self.assertEqual(m.tests_run, 1, "Tests run is not 1")
     self.assertFalse(m.was_skipped, "was_skipped is not false")
     self.assertEqual(m.last_result, "yay", "Last result is not correct")
     self.assertEqual(m.state(), MonitorState.OK,
                      "monitor did not report state correctly")
     self.assertEqual(m.virtual_fail_count(), 0,
                      "monitor did not report VFC of 0")
     self.assertEqual(m.test_success(), True, "test_success is not True")
Example #4
0
    def test_MonitorFail(self):
        m = Monitor()
        m.record_fail("boo")
        self.assertEqual(m.error_count, 1, "Error count is not 1")
        self.assertEqual(m.get_success_count(), 0, "Success count is not 0")
        self.assertEqual(m.tests_run, 1, "Tests run is not 1")
        self.assertFalse(m.was_skipped, "was_skipped is not false")
        self.assertEqual(m.last_result, "boo", "Last result is not correct")
        self.assertEqual(m.state(), MonitorState.FAILED,
                         "monitor did not report state correctly")
        self.assertEqual(m.virtual_fail_count(), 1,
                         "monitor did not calculate VFC correctly")
        self.assertEqual(m.test_success(), False, "test_success is not False")
        self.assertEqual(m.first_failure(), True, "First failure is not False")

        m.record_fail("cows")
        self.assertEqual(m.error_count, 2, "Error count is not 2")
        self.assertEqual(m.first_failure(), False,
                         "first_failure is not False")
        self.assertEqual(m.state(), MonitorState.FAILED, "state is not False")