Back to index

plone3  3.1.7
tests.py
Go to the documentation of this file.
00001 #
00002 # Allow testrunners to pick up tests
00003 #
00004 
00005 # $Id: tests.py 30089 2006-09-08 11:13:25Z shh42 $
00006 
00007 import unittest
00008 import os
00009 import Products.CMFTestCase
00010 
00011 suite = unittest.TestSuite()
00012 
00013 try:
00014     names = os.listdir(os.path.dirname(__file__))
00015 except OSError:
00016     tests = []
00017 else:
00018     tests = [x[:-3] for x in names
00019              if x.startswith('test') and x.endswith('.py')
00020              and x != 'tests.py']
00021 
00022 for test in tests:
00023     m = __import__('Products.CMFTestCase.%s' % test)
00024     m = getattr(Products.CMFTestCase, test)
00025     if hasattr(m, 'test_suite'):
00026         suite.addTest(m.test_suite())
00027 
00028 def test_suite():
00029     return suite
00030