run-tests: move existence/name format check into runone stable
authorMatt Mackall <mpm@selenic.com>
Thu, 21 Apr 2011 18:38:30 -0500
branchstable
changeset 903 92c48e9ca3a7
parent 902 fb867941518c
child 904 d758c9ebc705
run-tests: move existence/name format check into runone [ original upstream message ]
tests/run-tests.py
--- a/tests/run-tests.py	Thu Apr 21 18:19:45 2011 -0500
+++ b/tests/run-tests.py	Thu Apr 21 18:38:30 2011 -0500
@@ -639,6 +639,8 @@
     True -> passed
     False -> failed'''
 
+    testpath = os.path.join(TESTDIR, test)
+
     def skip(msg):
         if not options.verbose:
             skips.append((test, msg))
@@ -660,6 +662,15 @@
                 return
         fails.append((test, msg))
 
+    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):
+            skip("doesn't exist")
+            return None
+    else:
+        return None # not a supported test, don't record
+
     vlog("# Test", test)
 
     # create a fresh hgrc
@@ -678,7 +689,6 @@
         hgrc.write('appendpid=True\n')
     hgrc.close()
 
-    testpath = os.path.join(TESTDIR, test)
     ref = os.path.join(TESTDIR, test+".out")
     err = os.path.join(TESTDIR, test+".err")
     if os.path.exists(err):
@@ -944,7 +954,10 @@
                 continue
 
             if options.keywords:
-                fp = open(test)
+                try:
+                    fp = open(test)
+                except IOError:
+                    continue
                 t = fp.read().lower() + test.lower()
                 fp.close()
                 for k in options.keywords.lower().split():
@@ -1001,22 +1014,7 @@
         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
+    tests = args
 
     # Reset some environment variables to well-known values so that
     # the tests produce repeatable output.