run-tests: make a table of test types
authorMatt Mackall <mpm@selenic.com>
Fri, 24 May 2013 13:23:19 -0500
changeset 19239 db978c792b02
parent 19238 4122de8003e4
child 19240 b4ecdc451130
run-tests: make a table of test types
tests/run-tests.py
--- a/tests/run-tests.py	Fri May 24 13:02:00 2013 -0500
+++ b/tests/run-tests.py	Fri May 24 13:23:19 2013 -0500
@@ -904,17 +904,16 @@
             hgrc.write('[%s]\n%s\n' % (section, key))
     hgrc.close()
 
-    ref = os.path.join(TESTDIR, test+".out")
     err = os.path.join(TESTDIR, test+".err")
     if os.path.exists(err):
         os.remove(err)       # Remove any previous output files
     lctest = test.lower()
 
-    if lctest.endswith('.py'):
-        runner = pytest
-    elif lctest.endswith('.t'):
-        runner = tsttest
-        ref = testpath
+    for ext, func, out in testtypes:
+        if lctest.endswith(ext):
+            runner = func
+            ref = os.path.join(TESTDIR, test + out)
+            break
     else:
         return skip("unknown test type")
 
@@ -1234,6 +1233,9 @@
     if failed:
         sys.exit(1)
 
+testtypes = [('.py', pytest, '.out'),
+             ('.t', tsttest, '')]
+
 def main():
     (options, args) = parseargs()
     if not options.child: