run-tests: move keyword checking into runone
authorMatt Mackall <mpm@selenic.com>
Fri, 22 Apr 2011 11:24:27 -0500
changeset 13991 8cfe191e2ce4
parent 13990 ddf488bfbdbd
child 13992 ec4ae5727f07
run-tests: move keyword checking into runone
tests/run-tests.py
--- a/tests/run-tests.py	Fri Apr 22 11:22:02 2011 -0500
+++ b/tests/run-tests.py	Fri Apr 22 11:24:27 2011 -0500
@@ -671,6 +671,17 @@
     else:
         return None # not a supported test, don't record
 
+    if options.keywords:
+        fp = open(test)
+        t = fp.read().lower() + test.lower()
+        fp.close()
+        for k in options.keywords.lower().split():
+            if k in t:
+                break
+            else:
+                ignores.append((test, "doesn't match keyword"))
+                return None
+
     vlog("# Test", test)
 
     # create a fresh hgrc
@@ -954,20 +965,6 @@
                 ignores.append((test, "not retesting"))
                 continue
 
-            if options.keywords:
-                try:
-                    fp = open(test)
-                except IOError:
-                    continue
-                t = fp.read().lower() + test.lower()
-                fp.close()
-                for k in options.keywords.lower().split():
-                    if k in t:
-                        break
-                else:
-                    ignores.append((test, "doesn't match keyword"))
-                    continue
-
             ret = runone(options, test, skips, fails, ignores)
             if ret is None:
                 skipped += 1