Home | History | Annotate | Download | only in test
      1 import os
      2 import sys
      3 import unittest
      4 
      5 
      6 here = os.path.dirname(__file__)
      7 loader = unittest.defaultTestLoader
      8 
      9 def suite():
     10     suite = unittest.TestSuite()
     11     for fn in os.listdir(here):
     12         if fn.startswith("test") and fn.endswith(".py"):
     13             modname = "unittest.test." + fn[:-3]
     14             __import__(modname)
     15             module = sys.modules[modname]
     16             suite.addTest(loader.loadTestsFromModule(module))
     17     return suite
     18 
     19 
     20 if __name__ == "__main__":
     21     unittest.main(defaultTest="suite")
     22