From 767b4d524d6ac3a0ec8dac8e3c084720931b865b Mon Sep 17 00:00:00 2001 From: Italo Maia Date: Tue, 19 Jan 2010 17:29:27 -0300 Subject: [PATCH] =?UTF-8?q?adicionada=20op=C3=A7=C3=A3o=20de=20run=5Flevel?= =?UTF-8?q?.=20Permite=20escolher=20qual=20n=C3=ADvel=20de=20testes=20ser?= =?UTF-8?q?=C3=A1=20executado?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- run_tests.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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