run-tests: move keyword processing into Test.run()
authorGregory Szorc <gregory.szorc@gmail.com>
Sat, 19 Apr 2014 21:05:50 -0700
changeset 21331 bfe929a4b45b
parent 21330 3f79bacbf80b
child 21332 60ce874f5b06
run-tests: move keyword processing into Test.run()
tests/run-tests.py
--- a/tests/run-tests.py	Sat Apr 19 21:04:08 2014 -0700
+++ b/tests/run-tests.py	Sat Apr 19 21:05:50 2014 -0700
@@ -595,6 +595,16 @@
             if options.retest and not os.path.exists('%s.err' % self._test):
                 return self.ignore('not retesting')
 
+            if options.keywords:
+                f = open(self._test)
+                t = f.read().lower() + self._test.lower()
+                f.close()
+                for k in options.keywords.lower().split():
+                    if k in t:
+                        break
+                    else:
+                        return self.ignore("doesn't match keyword")
+
         # Remove any previous output files.
         if os.path.exists(self._errpath):
             os.remove(self._errpath)
@@ -1125,17 +1135,6 @@
     err = os.path.join(TESTDIR, test + ".err")
     lctest = test.lower()
 
-    if not (options.whitelisted and test in options.whitelisted):
-        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:
-                    return ignore("doesn't match keyword")
-
     if not os.path.basename(lctest).startswith("test-"):
         return skip("not a test file")
     for ext, cls, out in testtypes: