[Buildbot-commits] buildbot/buildbot/process step_twisted.py,1.59,1.60

Brian Warner warner at users.sourceforge.net
Fri Oct 15 18:44:22 UTC 2004


Update of /cvsroot/buildbot/buildbot/buildbot/process
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31334/buildbot/process

Modified Files:
	step_twisted.py 
Log Message:
* buildbot/process/step_twisted.py (Trial.createSummary): parse
the 'problems' portion of stdout, add TestResults to our build
* buildbot/test/test_twisted.py (Parse.testParse): test it


Index: step_twisted.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/process/step_twisted.py,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- step_twisted.py	29 Sep 2004 05:17:58 -0000	1.59
+++ step_twisted.py	15 Oct 2004 18:44:19 -0000	1.60
@@ -464,6 +464,13 @@
         self.text = text
         self.text2 = [text2]
 
+    def addTestResult(self, testname, results, text, logs):
+        if self.reactor is not None:
+            testname = (self.reactor,) + testname
+        tr = TestResult(testname, results, text, logs={'log': log})
+        #self.step_status.build.addTestResult(tr)
+        self.build.build_status.addTestResult(tr)
+
     def createSummary(self, log):
         output = log.getText()
         problems = ""
@@ -493,6 +500,49 @@
 
         if problems:
             self.addCompleteLog("problems", problems)
+            # now parse the problems for per-test results
+            pio = StringIO.StringIO(problems)
+            testname = None
+            done = False
+            while not done:
+                while 1:
+                    line = pio.readline()
+                    if line == "":
+                        done = True
+                        break
+                    if line.find("=" * 60) == 0:
+                        break
+                    if line.find("-" * 60) == 0:
+                        # the last case has --- as a separator before the
+                        # summary counts are printed
+                        done = True
+                        break
+                    if testname is None:
+                        # the first line after the === is like:
+# EXPECTED FAILURE: testLackOfTB (twisted.test.test_failure.FailureTestCase)
+# SKIPPED: testRETR (twisted.test.test_ftp.TestFTPServer)
+# FAILURE: testBatchFile (twisted.conch.test.test_sftp.TestOurServerBatchFile)
+                        r = re.search(r'^([^:]+): (\w+) \(([\w\.]+)\)', line)
+                        result, name, case = r.groups()
+                        testname = tuple(case.split(".") + [name])
+                        results = {'SKIPPED': SKIPPED,
+                                   'EXPECTED FAILURE': SUCCESS,
+                                   'UNEXPECTED SUCCESS': WARNINGS,
+                                   'FAILURE': FAILURE,
+                                   'ERROR': FAILURE,
+                                   'SUCCESS': SUCCESS, # not reported
+                                   }.get(result, WARNINGS)
+                        text = result.lower().split()
+                        log = line
+                        # the next line is all dashes
+                        log += pio.readline()
+                    else:
+                        # the rest goes into the log
+                        log += line
+                if testname:
+                    self.addTestResult(testname, results, text, log)
+                    testname = None
+
         if warnings:
             lines = warnings.keys()
             lines.sort()





More information about the Commits mailing list