From aabc3e7be1aae98ddd2e627659597ad4683c634a Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Wed, 5 Oct 2005 14:22:56 +0000 Subject: [PATCH] allow calling runtests on one test only Original commit message from CVS: allow calling runtests on one test only --- testsuite/runtests.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/testsuite/runtests.py b/testsuite/runtests.py index 3d3b95b151..5d2c39388b 100644 --- a/testsuite/runtests.py +++ b/testsuite/runtests.py @@ -28,17 +28,21 @@ import unittest SKIP_FILES = ['common', 'runtests'] -def gettestnames(): - dir = os.path.split(os.path.abspath(__file__))[0] - files = [os.path.basename(p) for p in glob.glob('%s/*.py' % dir)] - names = map(lambda x: x[:-3], files) - map(names.remove, SKIP_FILES) +def gettestnames(which): + if not which: + dir = os.path.split(os.path.abspath(__file__))[0] + which = [os.path.basename(p) for p in glob.glob('%s/*.py' % dir)] + + names = map(lambda x: x[:-3], which) + for f in SKIP_FILES: + if f in names: + names.remove(f) return names suite = unittest.TestSuite() loader = unittest.TestLoader() -for name in gettestnames(): +for name in gettestnames(sys.argv[1:]): suite.addTest(loader.loadTestsFromName(name)) descriptions = 1