SHARE
TWEET

Untitled

a guest Jun 19th, 2017 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. testmodules = [
  2.     'cogapp.test_makefiles',
  3.     'cogapp.test_whiteutils',
  4.     'cogapp.test_cogapp',
  5.     ]
  6.  
  7. suite = unittest.TestSuite()
  8.  
  9. for t in testmodules:
  10.     try:
  11.         # If the module defines a suite() function, call it to get the suite.
  12.         mod = __import__(t, globals(), locals(), ['suite'])
  13.         suitefn = getattr(mod, 'suite')
  14.         suite.addTest(suitefn())
  15.     except (ImportError, AttributeError):
  16.         # else, just load all the test cases from the module.
  17.         suite.addTest(unittest.defaultTestLoader.loadTestsFromName(t))
  18.  
  19. unittest.TextTestRunner().run(suite)
RAW Paste Data
Top