def test(*args): "Run all unit tests." os.chdir(ROOTDIR) #~ param.debug = False #~ param.verbose = False from runtests import test test(*args, blacklist = SKIP_DIRS)
def test(*args): "Run all unit tests." os.chdir(ROOTDIR) param.debug = False param.verbose = False from runtests import test test(*args, blacklist=SKIP_DIRS)
def all(*args): "Run all tests and doctests." test(*args) doctest(*args)
For example: - Launch all unit tests concerning geolib: $ ./tools/test.py geolib - Launch all unit tests contained in geolib/test_objets.py $ ./tools/test.py objets """) sys.exit() # Actions are launched if args: if args[0].startswith('--'): action = args[0][2:] args = args[1:] elif args[0].startswith('-'): act = args[0][1:] args = args[1:] if act in actions: action = actions[act] else: help() else: action = 'test' if action in actions.values(): locals()[action](*args) else: help() else: test()
Note that you may test only a few modules. For example: - Launch all unit tests concerning geolib: $ ./tools/test.py geolib - Launch all unit tests contained in geolib/test_objets.py $ ./tools/test.py objets """) sys.exit() # Actions are launched if args: if args[0].startswith('--'): action = args[0][2:] args = args[1:] elif args[0].startswith('-'): act = args[0][1:] args = args[1:] if act in actions: action = actions[act] else: help() else: action = 'test' if action in actions.itervalues(): locals()[action](*args) else: help() else: test()