changeset 21379:ab1a95270a50

run-tests: move parsehghaveoutput() into TTest This patch starts a sequence of patches that will try to isolate everything related to t tests into the TTest class.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 20 Apr 2014 10:14:25 -0700
parents f7ac3c63d844
children de6ea36ca9f7
files tests/run-tests.py
diffstat 1 files changed, 20 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Sun Apr 20 10:11:46 2014 -0700
+++ b/tests/run-tests.py	Sun Apr 20 10:14:25 2014 -0700
@@ -283,23 +283,6 @@
     shutil.copy(src, dst)
     os.remove(src)
 
-def parsehghaveoutput(lines):
-    '''Parse hghave log lines.
-    Return tuple of lists (missing, failed):
-      * the missing/unknown features
-      * the features for which existence check failed'''
-    missing = []
-    failed = []
-    for line in lines:
-        if line.startswith(SKIPPED_PREFIX):
-            line = line.splitlines()[0]
-            missing.append(line[len(SKIPPED_PREFIX):])
-        elif line.startswith(FAILED_PREFIX):
-            line = line.splitlines()[0]
-            failed.append(line[len(FAILED_PREFIX):])
-
-    return missing, failed
-
 def showdiff(expected, output, ref, err):
     print
     servefail = False
@@ -472,7 +455,7 @@
                 missing = ['unknown']
                 failed = None
             else:
-                missing, failed = parsehghaveoutput(out)
+                missing, failed = TTest.parsehghaveoutput(out)
 
             if not missing:
                 missing = ['irrelevant']
@@ -908,6 +891,25 @@
                 return '+glob'
         return False
 
+    @staticmethod
+    def parsehghaveoutput(lines):
+        '''Parse hghave log lines.
+
+        Return tuple of lists (missing, failed):
+          * the missing/unknown features
+          * the features for which existence check failed'''
+        missing = []
+        failed = []
+        for line in lines:
+            if line.startswith(SKIPPED_PREFIX):
+                line = line.splitlines()[0]
+                missing.append(line[len(SKIPPED_PREFIX):])
+            elif line.startswith(FAILED_PREFIX):
+                line = line.splitlines()[0]
+                failed.append(line[len(FAILED_PREFIX):])
+
+        return missing, failed
+
 wifexited = getattr(os, "WIFEXITED", lambda x: False)
 def run(cmd, wd, options, replacements, env, abort):
     """Run command in a sub-process, capturing the output (stdout and stderr).