[Checkins] SVN: zope.component/trunk/src/zope/component/tests.py Made the standalone test output parsing a bit more robust/relaxed. My shell was

Christian Theune ct at gocept.com
Thu Jul 5 05:28:13 EDT 2007


Log message for revision 77449:
  Made the standalone test output parsing a bit more robust/relaxed. My shell was
  issuing ascii sequences after a process was run and those would be considered
  to fail the tests.
  --This line, and those below, will be ignored--
  
  M    src/zope/component/tests.py
  

Changed:
  U   zope.component/trunk/src/zope/component/tests.py

-=-
Modified: zope.component/trunk/src/zope/component/tests.py
===================================================================
--- zope.component/trunk/src/zope/component/tests.py	2007-07-05 07:49:23 UTC (rev 77448)
+++ zope.component/trunk/src/zope/component/tests.py	2007-07-05 09:28:11 UTC (rev 77449)
@@ -966,7 +966,6 @@
                                    stdout=subprocess.PIPE,
                                    stderr=subprocess.STDOUT,
                                    stdin=subprocess.PIPE)
-
         pickle.dump(sys.path, process.stdin)
         process.stdin.close()
 
@@ -977,13 +976,22 @@
                 raise # TODO verify sanity of a pass on EINTR :-/
         lines = process.stdout.readlines()
         process.stdout.close()
+        success = True
+        # Interpret the result: We scan the output from the end backwards
+        # until we find either a line that says 'OK' (which means the tests
+        # ran successfully) or a line that starts with quite a few dashes
+        # (which means we didn't find a line that says 'OK' within the summary
+        # of the test runner and the tests did not run successfully.)
         for l in reversed(lines):
             l = l.strip()
-            if l:
-                if not l.endswith('OK'):
-                    self.fail(''.join(lines))
-                else:
-                    break
+            if not l:
+                continue
+            if l.startswith('-----'):
+                break
+            if l.endswith('OK'):
+                sucess = True
+        if not success:
+            self.fail(''.join(lines))
 
 def setUpRegistryTests(tests):
     setUp()



More information about the Checkins mailing list