SyFi 0.3
newtests/test.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 """Run all tests"""
00003 
00004 __author__ = "Martin Alnes <martinal@simula.no>"
00005 __date__ = "2008-09-04 -- 2008-09-04"
00006 
00007 import os, glob
00008 
00009 # disable most log output
00010 import sfc
00011 sfc.set_logging_level("error")
00012 
00013 # define test set
00014 tests = glob.glob("*.py")
00015 skip = set(["test.py", "template.py", "cell_assembly.py"])
00016 tests = (t for t in tests if not (t in skip or t.startswith("_")))
00017 
00018 # two ways of running tests
00019 separate = True
00020 if separate:
00021     # run all test from commandline (separate python processes)
00022     for test in tests:
00023         cmd = "python %s" % test
00024         print "Running '%s'" % cmd
00025         os.system(cmd)
00026 else:
00027     # collect test classes
00028     classes = []
00029     for test in tests:
00030         classes.extend(test.tests)
00031 
00032     # run all tests
00033     verbosity = 0
00034     suites = [unittest.makeSuite(c) for c in classes]
00035     testsuites = unittest.TestSuite(suites)
00036     unittest.TextTestRunner(verbosity=verbosity).run(testsuites)
00037 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines