Change the PyUnit-based tests to use the test_main() approach. This

allows using the tests with unittest.py as a script.  The tests will
still run when run as a script themselves.
This commit is contained in:
Fred Drake 2001-09-20 21:33:42 +00:00
parent 6f7993765a
commit 2e2be3760c
34 changed files with 229 additions and 39 deletions

View file

@ -2,7 +2,7 @@ import sys
import unittest
import weakref
from test_support import run_unittest
import test_support
class C:
@ -434,5 +434,13 @@ class MappingTestCase(TestBase):
self.assert_(d.items() == [('something else', o2)])
run_unittest(ReferencesTestCase)
run_unittest(MappingTestCase)
def test_main():
loader = unittest.TestLoader()
suite = unittest.TestSuite()
suite.addTest(loader.loadTestsFromTestCase(ReferencesTestCase))
suite.addTest(loader.loadTestsFromTestCase(MappingTestCase))
test_support.run_suite(suite)
if __name__ == "__main__":
test_main()