[Buildbot-commits] buildbot/buildbot/test test_twisted.py,1.6,1.7

Brian Warner warner at users.sourceforge.net
Thu Jun 15 05:47:51 UTC 2006


Update of /cvsroot/buildbot/buildbot/buildbot/test
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30765/buildbot/test

Modified Files:
	test_twisted.py 
Log Message:
[project @ implement TrialTestCaseCounter, a LogObserver that counts test cases run]

Original author: warner at lothar.com
Date: 2006-06-15 01:29:02

Index: test_twisted.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_twisted.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- test_twisted.py	15 May 2005 23:43:57 -0000	1.6
+++ test_twisted.py	15 Jun 2006 05:47:48 -0000	1.7
@@ -2,6 +2,8 @@
 
 from twisted.trial import unittest
 
+from buildbot import interfaces
+from buildbot.process import step_twisted
 from buildbot.process.step_twisted import countFailedTests, Trial
 from buildbot.status import builder
 
@@ -131,6 +133,39 @@
         count = countFailedTests(out5)
         self.assertEquals(count, self.count(total=None))
 
+class Counter(unittest.TestCase):
+
+    def setProgress(self, metric, value):
+        self.progress = (metric, value)
+
+    def testCounter(self):
+        self.progress = (None,None)
+        c = step_twisted.TrialTestCaseCounter()
+        c.setStep(self)
+        STDOUT = interfaces.LOG_CHANNEL_STDOUT
+        def add(text):
+            c.logChunk(None, None, None, STDOUT, text)
+        add("\n\n")
+        self.failUnlessEqual(self.progress, (None,None))
+        add("bogus line\n")
+        self.failUnlessEqual(self.progress, (None,None))
+        add("buildbot.test.test_config.ConfigTest.testBots ... [OK]\n")
+        self.failUnlessEqual(self.progress, ("tests", 1))
+        add("buildbot.test.test_config.ConfigTest.tes")
+        self.failUnlessEqual(self.progress, ("tests", 1))
+        add("tBuilders ... [OK]\n")
+        self.failUnlessEqual(self.progress, ("tests", 2))
+        # confirm alternative delimiters work too.. ptys seem to emit
+        # something different
+        add("buildbot.test.test_config.ConfigTest.testIRC ... [OK]\r\n")
+        self.failUnlessEqual(self.progress, ("tests", 3))
+        add("===============================================================================\n")
+        self.failUnlessEqual(self.progress, ("tests", 3))
+        add("buildbot.test.test_config.IOnlyLookLikeA.testLine ... [OK]\n")
+        self.failUnlessEqual(self.progress, ("tests", 3))
+
+
+
 class Parse(unittest.TestCase):
     def failUnlessIn(self, substr, string):
         self.failUnless(string.find(substr) != -1)





More information about the Commits mailing list