Back to index

plone3  3.1.7
runalltests.py
Go to the documentation of this file.
00001 #
00002 # Runs all tests in the current directory
00003 #
00004 # Execute like:
00005 #   python runalltests.py
00006 #
00007 # Alternatively use the testrunner: 
00008 #   python /path/to/Zope/utilities/testrunner.py -qa
00009 #
00010 
00011 import os, sys
00012 if __name__ == '__main__':
00013     execfile(os.path.join(sys.path[0], 'framework.py')) 
00014 
00015 import unittest
00016 TestRunner = unittest.TextTestRunner
00017 suite = unittest.TestSuite()
00018 
00019 tests = os.listdir(os.curdir)
00020 tests = [n[:-3] for n in tests if n.startswith('test') and n.endswith('.py')]
00021 
00022 for test in tests:
00023     m = __import__(test)
00024     if hasattr(m, 'test_suite'):
00025         suite.addTest(m.test_suite())
00026 
00027 if __name__ == '__main__':
00028     TestRunner().run(suite)
00029