[Buildbot-commits] buildbot/buildbot/test runutils.py, 1.7, 1.8 test_steps.py, 1.20, 1.21
Brian Warner
warner at users.sourceforge.net
Tue Jun 20 08:08:34 UTC 2006
Update of /cvsroot/buildbot/buildbot/buildbot/test
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14527/buildbot/test
Modified Files:
runutils.py test_steps.py
Log Message:
[project @ tests: some rmtree refactoring, and create SlaveCommandTestBase]
Original author: warner at lothar.com
Date: 2006-06-16 19:53:52
Index: runutils.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/runutils.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- runutils.py 20 Jun 2006 08:08:11 -0000 1.7
+++ runutils.py 20 Jun 2006 08:08:30 -0000 1.8
@@ -261,3 +261,28 @@
self.updates.append(data)
+class SlaveCommandTestBase(SignalMixin):
+ usePTY = False
+ def setUp(self):
+ self.builder = FakeSlaveBuilder(self.usePTY)
+
+ def startCommand(self, cmdclass, args):
+ stepId = 0
+ c = cmdclass(self.builder, stepId, args)
+ c.running = True
+ d = c.start()
+ return d
+
+ def collectUpdates(self, res):
+ logs = {}
+ for u in self.builder.updates:
+ for k in u.keys():
+ if k == "log":
+ logname,data = u[k]
+ oldlog = logs.get(("log",logname), "")
+ logs[("log",logname)] = oldlog + u[k]
+ elif k == "rc":
+ pass
+ else:
+ logs[k] = logs.get(k, "") + u[k]
+ return logs
Index: test_steps.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_steps.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- test_steps.py 16 Jun 2006 05:28:13 -0000 1.20
+++ test_steps.py 20 Jun 2006 08:08:32 -0000 1.21
@@ -5,7 +5,7 @@
# the test harness should send statusUpdate() messages in with assorted
# data, eventually calling remote_complete(). Then we can verify that the
# Step's rc was correct, and that the status it was supposed to return
-# mathces.
+# matches.
# sometimes, .callRemote should raise an exception because of a stale
# reference. Sometimes it should errBack with an UnknownCommand failure.
@@ -24,7 +24,7 @@
from buildbot.process import step, base, factory
from buildbot.process.step import ShellCommand #, ShellCommands
from buildbot.status import builder
-from buildbot.test.runutils import RunMixin, setupBuildStepStatus
+from buildbot.test.runutils import RunMixin, rmtree, setupBuildStepStatus
from buildbot.twcompat import maybeWait
from buildbot.slave import commands
@@ -67,7 +67,9 @@
class BuildStep(unittest.TestCase):
+
def setUp(self):
+ rmtree("test_steps")
self.builder = FakeBuilder()
self.builder_status = builder.BuilderStatus("fakebuilder")
self.builder_status.basedir = "test_steps"
@@ -156,6 +158,7 @@
self.assertEqual(self.failed, 0)
self.assertEqual(self.results, 0)
+
class Steps(unittest.TestCase):
def testMultipleStepInstances(self):
steps = [
More information about the Commits
mailing list