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

Method test_teardown_module

Lib/test/test_unittest/test_setups.py:342–360  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

340 self.assertEqual(result.testsRun, 2)
341
342 def test_teardown_module(self):
343 class Module(object):
344 moduleTornDown = 0
345 @staticmethod
346 def tearDownModule():
347 Module.moduleTornDown += 1
348
349 class Test(unittest.TestCase):
350 def test_one(self):
351 pass
352 def test_two(self):
353 pass
354 Test.__module__ = 'Module'
355 sys.modules['Module'] = Module
356
357 result = self.runTests(Test)
358 self.assertEqual(Module.moduleTornDown, 1)
359 self.assertEqual(result.testsRun, 2)
360 self.assertEqual(len(result.errors), 0)
361
362 def test_error_in_teardown_module(self):
363 class Module(object):

Callers

nothing calls this directly

Calls 2

runTestsMethod · 0.95
assertEqualMethod · 0.45

Tested by

no test coverage detected