def test_should_be_ok_if_all_results_are(self): ok1 = self.result_mock(ok=True) ok2 = self.result_mock(ok=True) trs = TestResultSet() trs.add(ok1.raw) trs.add(ok2.raw) self.assertTrue(trs.ok())
def test_should_be_ok_if_all_results_are(self): ok1 = self.result_mock(ok = True) ok2 = self.result_mock(ok = True) trs = TestResultSet() trs.add(ok1.raw) trs.add(ok2.raw) self.assertTrue(trs.ok())
def test_should_be_ok_if_all_results_are_success_or_skip(self): ok1 = make_result('success') ok2 = make_result('skipped') trs = TestResultSet() trs.add(ok1) trs.add(ok2) self.assertTrue(trs.ok())
def test_should_pickle(self): state = FileState(self.filename) state.info = TestResultSet() result = TestResult('error', 'test', 'errors', 01234) state.info.add(result) import pickle pickled = pickle.dumps(state) loaded_state = pickle.loads(pickled) self.assertEqual(repr(state), repr(loaded_state) + "___")
def test_should_clear_all_non_newest_results_on_add(self): old = self.result_mock(time=1, name='old') new = self.result_mock(time=2, name='new') new2 = self.result_mock(time=2, name='new2') trs = TestResultSet() trs.add(old.raw) self.assertEqual(trs.results, [old.raw]) trs.add(new.raw) self.assertEqual(trs.results, [new.raw]) trs.add(new2.raw) self.assertEqual(trs.results, [new.raw, new2.raw])
def test_should_not_be_ok_if_any_result_is_not(self): ok1 = self.result_mock(ok=True, name='ok1') ok2 = self.result_mock(ok=True, name='ok2') not_ok = self.result_mock(ok=False) trs = TestResultSet() trs.add(ok1.raw) trs.add(ok2.raw) trs.add(not_ok.raw) self.assertFalse(trs.ok())
def test_should_not_be_ok_if_any_result_is_not(self): ok1 = self.result_mock(ok = True, name='ok1') ok2 = self.result_mock(ok = True, name='ok2') not_ok = self.result_mock(ok = False) trs = TestResultSet() trs.add(ok1.raw) trs.add(ok2.raw) trs.add(not_ok.raw) self.assertFalse(trs.ok())
def test_should_be_ok_with_no_test_cases(self): trs = TestResultSet() self.assertTrue(trs.ok())
def test_should_default_to_new_test_result_set_info(self): self.assertEqual(FileState(self.filename).info, TestResultSet())