diff options
| author | Adam Johnson <me@adamj.eu> | 2021-03-16 12:43:23 +0000 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-03-18 15:30:47 +0100 |
| commit | e3bca22e7e572b0274a0814c7869c899d7b544e0 (patch) | |
| tree | b4f43acec4cfd35e956a3ba79d2f062cab902b84 /tests/test_runner | |
| parent | 92975bcd5f6281d6124f30cd4a71e0adedd78781 (diff) | |
Refs #31370 -- Made RemoteTestResult subclass unittest.TestResult.
Diffstat (limited to 'tests/test_runner')
| -rw-r--r-- | tests/test_runner/test_parallel.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test_runner/test_parallel.py b/tests/test_runner/test_parallel.py index 365c248a43..a56d82c7bd 100644 --- a/tests/test_runner/test_parallel.py +++ b/tests/test_runner/test_parallel.py @@ -52,6 +52,35 @@ class SampleFailingSubtest(SimpleTestCase): class RemoteTestResultTest(SimpleTestCase): + def test_was_successful_no_events(self): + result = RemoteTestResult() + self.assertIs(result.wasSuccessful(), True) + + def test_was_successful_one_success(self): + result = RemoteTestResult() + result.addSuccess(None) + self.assertIs(result.wasSuccessful(), True) + + def test_was_successful_one_expected_failure(self): + result = RemoteTestResult() + result.addExpectedFailure(None, ValueError('woops')) + self.assertIs(result.wasSuccessful(), True) + + def test_was_successful_one_skip(self): + result = RemoteTestResult() + result.addSkip(None, 'Skipped') + self.assertIs(result.wasSuccessful(), True) + + def test_was_successful_one_error(self): + result = RemoteTestResult() + result.addError(None, ValueError('woops')) + self.assertIs(result.wasSuccessful(), False) + + def test_was_successful_one_failure(self): + result = RemoteTestResult() + result.addFailure(None, ValueError('woops')) + self.assertIs(result.wasSuccessful(), False) + def test_picklable(self): result = RemoteTestResult() loaded_result = pickle.loads(pickle.dumps(result)) @@ -81,6 +110,7 @@ class RemoteTestResultTest(SimpleTestCase): events = result.events self.assertEqual(len(events), 4) + self.assertIs(result.wasSuccessful(), False) event = events[1] self.assertEqual(event[0], 'addSubTest') |
