diff --git a/run_tests.py b/run_tests.py index cfa92bb..8dcf69e 100644 --- a/run_tests.py +++ b/run_tests.py @@ -1,11 +1,24 @@ import sys, doctest, os, glob +from getopt import gnu_getopt as getopt CUR_DIR = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, CUR_DIR) if __name__ == '__main__': + run_level = None + optlist, args = getopt(sys.argv[1:], "l:", ['--level=']) + + for opt, arg in optlist: + if opt in ("-l", "--list"): + run_level = arg.zfill(2) + # Test each package - test_files = glob.glob('%s/*.txt' % os.path.join(CUR_DIR, 'tests')) + if run_level is None: + test_files = glob.glob('%s/*.txt' % os.path.join(CUR_DIR, 'tests')) + else: + test_files = glob.glob('%s/%s-*.txt' % \ + (os.path.join(CUR_DIR, 'tests'), run_level)) + test_files = map(lambda i: i[len(CUR_DIR)+1:], test_files) # Run the tests