Back to index

plone3  3.1.7
runalltests.py
Go to the documentation of this file.
00001 # -*- coding: utf-8 -*-
00002 ## GroupUserFolder
00003 ## Copyright (C)2006 Ingeniweb
00004 
00005 ## This program is free software; you can redistribute it and/or modify
00006 ## it under the terms of the GNU General Public License as published by
00007 ## the Free Software Foundation; either version 2 of the License, or
00008 ## (at your option) any later version.
00009 
00010 ## This program is distributed in the hope that it will be useful,
00011 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 ## GNU General Public License for more details.
00014 
00015 ## You should have received a copy of the GNU General Public License
00016 ## along with this program; see the file COPYING. If not, write to the
00017 ## Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 """
00019 
00020 """
00021 __version__ = "$Revision:  $"
00022 # $Source:  $
00023 # $Id: runalltests.py 30098 2006-09-08 12:35:01Z encolpe $
00024 __docformat__ = 'restructuredtext'
00025 
00026 #
00027 # Runs all tests in the current directory
00028 #
00029 # Execute like:
00030 #   python runalltests.py
00031 #
00032 # Alternatively use the testrunner:
00033 #   python /path/to/Zope/utilities/testrunner.py -qa
00034 #
00035 
00036 import os, sys
00037 if __name__ == '__main__':
00038     execfile(os.path.join(sys.path[0], 'framework.py'))
00039 
00040 import unittest
00041 TestRunner = unittest.TextTestRunner
00042 suite = unittest.TestSuite()
00043 
00044 tests = os.listdir(os.curdir)
00045 tests = [n[:-3] for n in tests if n.startswith('test') and n.endswith('.py')]
00046 
00047 for test in tests:
00048     m = __import__(test)
00049     if hasattr(m, 'test_suite'):
00050         suite.addTest(m.test_suite())
00051 
00052 if __name__ == '__main__':
00053     TestRunner().run(suite)