Back to index

rabbitmq-server  2.8.4
test_runner.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 import unittest
00004 import sys
00005 import os
00006 
00007 def add_deps_to_path():
00008     deps_dir = os.path.realpath(os.path.join(__file__, "..", "..", "..", "deps"))
00009     sys.path.append(os.path.join(deps_dir, "stomppy", "stomppy"))
00010 
00011 def run_unittests(modules):
00012     add_deps_to_path()
00013 
00014     suite = unittest.TestSuite()
00015     for m in modules:
00016         mod = __import__(m)
00017         for name in dir(mod):
00018             obj = getattr(mod, name)
00019             if name.startswith("Test") and issubclass(obj, unittest.TestCase):
00020                 suite.addTest(unittest.TestLoader().loadTestsFromTestCase(obj))
00021 
00022     ts = unittest.TextTestRunner().run(unittest.TestSuite(suite))
00023     if ts.errors or ts.failures:
00024         sys.exit(1)
00025