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 suite = unittest.TestSuite()
00017 
00018 tests = os.listdir(os.curdir)
00019 tests = [n[:-3] for n in tests if n.startswith('test') and n.endswith('.py')]
00020 
00021 for test in tests:
00022     m = __import__(test)
00023     if hasattr(m, 'test_suite'):
00024         suite.addTest(m.test_suite())
00025 
00026 if __name__ == '__main__':
00027     TestRunner().run(suite)