MCPcopy Index your code
hub / github.com/python/cpython / test_stopTest

Method test_stopTest

Lib/test/test_unittest/test_result.py:91–115  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

89 # "Called after the test case test has been executed, regardless of
90 # the outcome. The default implementation does nothing."
91 def test_stopTest(self):
92 class Foo(unittest.TestCase):
93 def test_1(self):
94 pass
95
96 test = Foo('test_1')
97
98 result = unittest.TestResult()
99
100 result.startTest(test)
101
102 self.assertTrue(result.wasSuccessful())
103 self.assertEqual(len(result.errors), 0)
104 self.assertEqual(len(result.failures), 0)
105 self.assertEqual(result.testsRun, 1)
106 self.assertEqual(result.shouldStop, False)
107
108 result.stopTest(test)
109
110 # Same tests as above; make sure nothing has changed
111 self.assertTrue(result.wasSuccessful())
112 self.assertEqual(len(result.errors), 0)
113 self.assertEqual(len(result.failures), 0)
114 self.assertEqual(result.testsRun, 1)
115 self.assertEqual(result.shouldStop, False)
116
117 # "Called before and after tests are run. The default implementation does nothing."
118 def test_startTestRun_stopTestRun(self):

Callers

nothing calls this directly

Calls 6

startTestMethod · 0.95
wasSuccessfulMethod · 0.95
stopTestMethod · 0.95
assertTrueMethod · 0.80
FooClass · 0.70
assertEqualMethod · 0.45

Tested by

no test coverage detected