Source code for slicer.testing
#
# Testing
#
def exitSuccess():
[docs] pass
def exitFailure(message = ""):
[docs] raise Exception(message)
def runUnitTest(path, testname):
[docs] import sys
import unittest
if isinstance(path, basestring):
sys.path.append(path)
else:
sys.path.extend(path)
print "-------------------------------------------"
print "path: %s\ntestname: %s" % (path, testname)
print "-------------------------------------------"
suite = unittest.TestLoader().loadTestsFromName(testname)
result = unittest.TextTestRunner(verbosity=2).run(suite)
if not result.wasSuccessful():
exitFailure()