summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/test/test_runner.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/unittest/test/test_runner.py')
-rw-r--r--Lib/unittest/test/test_runner.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/Lib/unittest/test/test_runner.py b/Lib/unittest/test/test_runner.py
index e22e6bc..7c0bd51 100644
--- a/Lib/unittest/test/test_runner.py
+++ b/Lib/unittest/test/test_runner.py
@@ -5,8 +5,10 @@ import pickle
import subprocess
import unittest
+from unittest.case import _Outcome
-from .support import LoggingResult, ResultWithNoStartTestRunStopTestRun
+from unittest.test.support import (LoggingResult,
+ ResultWithNoStartTestRunStopTestRun)
class TestCleanUp(unittest.TestCase):
@@ -42,12 +44,8 @@ class TestCleanUp(unittest.TestCase):
def testNothing(self):
pass
- class MockOutcome(object):
- success = True
- errors = []
-
test = TestableTest('testNothing')
- test._outcomeForDoCleanups = MockOutcome
+ outcome = test._outcome = _Outcome()
exc1 = Exception('foo')
exc2 = Exception('bar')
@@ -61,9 +59,10 @@ class TestCleanUp(unittest.TestCase):
test.addCleanup(cleanup2)
self.assertFalse(test.doCleanups())
- self.assertFalse(MockOutcome.success)
+ self.assertFalse(outcome.success)
- (Type1, instance1, _), (Type2, instance2, _) = reversed(MockOutcome.errors)
+ ((_, (Type1, instance1, _)),
+ (_, (Type2, instance2, _))) = reversed(outcome.errors)
self.assertEqual((Type1, instance1), (Exception, exc1))
self.assertEqual((Type2, instance2), (Exception, exc2))
@@ -341,3 +340,7 @@ class Test_TextTestRunner(unittest.TestCase):
f = io.StringIO()
runner = unittest.TextTestRunner(f)
self.assertTrue(runner.stream.stream is f)
+
+
+if __name__ == "__main__":
+ unittest.main()