changeset 19239:db978c792b02

run-tests: make a table of test types
author Matt Mackall <mpm@selenic.com>
date Fri, 24 May 2013 13:23:19 -0500
parents 4122de8003e4
children b4ecdc451130
files tests/run-tests.py
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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: