mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
Standardize on test.test_support.run_unittest() (as opposed to a mix of run_unittest() and run_suite()). Also, add functionality to run_unittest() that admits usage of unittest.TestLoader.loadTestsFromModule().
This commit is contained in:
parent
0d4c06e06e
commit
c2898c5a67
29 changed files with 87 additions and 180 deletions
|
|
@ -1631,18 +1631,8 @@ class TestParseNumber(BaseTest):
|
|||
"option -l: invalid long integer value: '0x12x'")
|
||||
|
||||
|
||||
def _testclasses():
|
||||
mod = sys.modules[__name__]
|
||||
return [getattr(mod, name) for name in dir(mod) if name.startswith('Test')]
|
||||
|
||||
def suite():
|
||||
suite = unittest.TestSuite()
|
||||
for testclass in _testclasses():
|
||||
suite.addTest(unittest.makeSuite(testclass))
|
||||
return suite
|
||||
|
||||
def test_main():
|
||||
test_support.run_suite(suite())
|
||||
test_support.run_unittest(__name__)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
test_main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue