Guest User

Untitled

a guest
Jul 29th, 2016
68
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import argparse, unittest, sys
  2.  
  3. parser = argparse.ArgumentParser(description = 'Execution type')
  4. parser.add_argument('--type', action = 'store',
  5.                               type = int,
  6.                               default = 1)
  7.                                
  8. options, args = parser.parse_known_args()
  9.  
  10. def main():
  11.     pass
  12.  
  13. def run_tests():
  14.     from tests import tests_models, tests_dbconnections, tests_dals
  15.  
  16.     suit = unittest.TestSuite()
  17.     suit.addTest(unittest.makeSuite(tests_models.TestPerson))
  18.     suit.addTest(unittest.makeSuite(tests_models.TestClient))
  19.     suit.addTest(unittest.makeSuite(tests_dbconnections.TestPgSqlConnection))
  20.     suit.addTest(unittest.makeSuite(tests_dals.TestPgSqlDal))
  21.  
  22.     return suit
  23.  
  24. # Execute: python3 start.py
  25.  
  26. if __name__ == '__main__':
  27.     if options.type:
  28.         sys.argv[1:] = args
  29.         unittest.main(defaultTest = 'run_tests', verbosity = 2)
  30.     else:
  31.         main()
RAW Paste Data