run-tests.py: do not install hg when the tests do no exist
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Sat, 09 Oct 2010 16:25:28 -0500
changeset 12677 9848a94e2ad6
parent 12676 ef500b2f100b
child 12678 61642a4679e9
run-tests.py: do not install hg when the tests do no exist
tests/run-tests.py
--- a/tests/run-tests.py	Sat Oct 09 15:40:29 2010 -0500
+++ b/tests/run-tests.py	Sat Oct 09 16:25:28 2010 -0500
@@ -983,6 +983,27 @@
 
         checktools()
 
+    if len(args) == 0:
+        args = os.listdir(".")
+    args.sort()
+
+    tests = []
+    skipped = []
+    for test in args:
+        if (test.startswith("test-") and '~' not in test and
+            ('.' not in test or test.endswith('.py') or
+             test.endswith('.bat') or test.endswith('.t'))):
+            if not os.path.exists(test):
+                skipped.append(test)
+            else:
+                tests.append(test)
+    if not tests:
+        for test in skipped:
+            print 'Skipped %s: does not exist' % test
+        print "# Ran 0 tests, %d skipped, 0 failed." % len(skipped)
+        return
+    tests = tests + skipped
+
     # Reset some environment variables to well-known values so that
     # the tests produce repeatable output.
     os.environ['LANG'] = os.environ['LC_ALL'] = os.environ['LANGUAGE'] = 'C'
@@ -1069,20 +1090,6 @@
 
     COVERAGE_FILE = os.path.join(TESTDIR, ".coverage")
 
-    if len(args) == 0:
-        args = os.listdir(".")
-        args.sort()
-
-    tests = []
-    for test in args:
-        if (test.startswith("test-") and '~' not in test and
-            ('.' not in test or test.endswith('.py') or
-             test.endswith('.bat') or test.endswith('.t'))):
-            tests.append(test)
-    if not tests:
-        print "# Ran 0 tests, 0 skipped, 0 failed."
-        return
-
     vlog("# Using TESTDIR", TESTDIR)
     vlog("# Using HGTMP", HGTMP)
     vlog("# Using PATH", os.environ["PATH"])