4
4
# Contact: garth@deadlybloodyserious.com
5
# Revision: $Revision: 1.6 $
6
# Date: $Date: 2002/10/09 00:51:52 $
5
# Revision: $Revision: 2454 $
6
# Date: $Date: 2004-07-25 13:29:43 +0200 (Sun, 25 Jul 2004) $
7
7
# Copyright: This module has been placed in the public domain.
67
67
usageExit("No command-line arguments supported yet.")
68
68
except getopt.error, msg:
71
71
def loadTestModules(path, name='', packages=None):
99
99
for mod in testModules:
101
101
print >>sys.stderr, "importing %s" % mod
102
module = import_module(mod)
103
# if there's a suite defined, incorporate its contents
105
suite = getattr(module, 'suite')
106
except AttributeError:
107
# Look for individual tests
108
moduleTests = testLoader.loadTestsFromModule(module)
109
# unittest.TestSuite.addTests() doesn't work as advertised,
110
# as it can't load tests from another TestSuite, so we have
112
testSuite.addTest(moduleTests)
114
if type(suite) == types.FunctionType:
115
testSuite.addTest(suite())
116
elif type(suite) == types.InstanceType \
117
and isinstance(suite, unittest.TestSuite):
118
testSuite.addTest(suite)
103
module = import_module(mod)
105
print >>sys.stderr, "ERROR: Can't import %s, skipping its tests:" % mod
106
sys.excepthook(*sys.exc_info())
120
raise AssertionError, "don't understand suite (%s)" % mod
108
# if there's a suite defined, incorporate its contents
110
suite = getattr(module, 'suite')
111
except AttributeError:
112
# Look for individual tests
113
moduleTests = testLoader.loadTestsFromModule(module)
114
# unittest.TestSuite.addTests() doesn't work as advertised,
115
# as it can't load tests from another TestSuite, so we have
117
testSuite.addTest(moduleTests)
119
if type(suite) == types.FunctionType:
120
testSuite.addTest(suite())
121
elif type(suite) == types.InstanceType \
122
and isinstance(suite, unittest.TestSuite):
123
testSuite.addTest(suite)
125
raise AssertionError, "don't understand suite (%s)" % mod