Issue #19013: add unittest.main() epilogs to unittest's own test modules

This commit is contained in:
Antoine Pitrou 2013-09-13 23:52:46 +02:00
parent 87456e53a8
commit 1d7c8c9a00
8 changed files with 29 additions and 0 deletions

View File

@ -361,3 +361,7 @@ class TestLongMessage(unittest.TestCase):
['^"regex" does not match "foo"$', '^oops$',
'^"regex" does not match "foo"$',
'^"regex" does not match "foo" : oops$'])
if __name__ == "__main__":
unittest.main()

View File

@ -282,3 +282,7 @@ class TestBreakSignalIgnored(TestBreak):
"if threads have been used")
class TestBreakSignalDefault(TestBreak):
int_handler = signal.SIG_DFL
if __name__ == "__main__":
unittest.main()

View File

@ -1405,3 +1405,7 @@ test case
with support.disable_gc():
del case
self.assertFalse(wr())
if __name__ == "__main__":
unittest.main()

View File

@ -142,3 +142,7 @@ class Test_FunctionTestCase(unittest.TestCase):
test = unittest.FunctionTestCase(lambda: None, description=desc)
self.assertEqual(test.shortDescription(), "this tests foo")
if __name__ == "__main__":
unittest.main()

View File

@ -1306,3 +1306,7 @@ class Test_TestLoader(unittest.TestCase):
def test_suiteClass__default_value(self):
loader = unittest.TestLoader()
self.assertTrue(loader.suiteClass is unittest.TestSuite)
if __name__ == "__main__":
unittest.main()

View File

@ -339,3 +339,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()

View File

@ -501,5 +501,6 @@ class TestSetups(unittest.TestCase):
with self.assertRaisesRegex(Exception, msg):
suite.debug()
if __name__ == '__main__':
unittest.main()

View File

@ -221,3 +221,7 @@ class Test_TestSkipping(unittest.TestCase):
suite = unittest.TestSuite([test])
suite.run(result)
self.assertEqual(result.skipped, [(test, "testing")])
if __name__ == "__main__":
unittest.main()