diff --git a/src/unittests/run.py b/src/unittests/run.py index 10cf8699..4830b399 100755 --- a/src/unittests/run.py +++ b/src/unittests/run.py @@ -4,18 +4,30 @@ import unittest import sys sys.path.append(".") -import specfiletests -import fetchertests -import archivetests +runTestSuite = lambda(x): unittest.TextTestRunner(verbosity=2).run(x) + +def run_all(): + import specfiletests + import fetchertests + import archivetests -def main(): alltests = unittest.TestSuite(( specfiletests.suite, fetchertests.suite, archivetests.suite )) - unittest.TextTestRunner(verbosity=2).run(alltests) + runTestSuite(alltests) if __name__ == "__main__": - main() + args = sys.argv + if len(args) > 1: # run modules given from the command line + tests = sys.argv[1:] + for test in tests: + module = __import__(test) + print "\nRunning tests in '%s'...\n" % (test) + runTestSuite(module.suite) + + else: # run all tests + print "\nRunning all test in an order...\n" + run_all()