[Buildbot-commits] buildbot/buildbot/test test_control.py, 1.12, 1.13 test_run.py, 1.41, 1.42

Brian Warner warner at users.sourceforge.net
Fri Nov 24 07:19:57 UTC 2006


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

Modified Files:
	test_control.py test_run.py 
Log Message:
[project @ finally remove forceBuild]

Original author: warner at lothar.com
Date: 2006-11-24 06:54:31

Index: test_control.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_control.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- test_control.py	15 Sep 2006 14:47:41 -0000	1.12
+++ test_control.py	24 Nov 2006 07:19:55 -0000	1.13
@@ -72,51 +72,34 @@
             dl.append(defer.maybeDeferred(self.master.stopService))
         return maybeWait(defer.DeferredList(dl))
 
-    def testForce(self):
-        # TODO: since BuilderControl.forceBuild has been deprecated, this
-        # test is scheduled to be removed soon
+    def testRequest(self):
         m = self.master
         m.loadConfig(config)
         m.startService()
         d = self.connectSlave()
-        d.addCallback(self._testForce_1)
+        d.addCallback(self._testRequest_1)
         return maybeWait(d)
-
-    def _testForce_1(self, res):
+    def _testRequest_1(self, res):
         c = interfaces.IControl(self.master)
+        req = base.BuildRequest("I was bored", SourceStamp())
         builder_control = c.getBuilder("force")
-        d = builder_control.forceBuild("bob", "I was bored")
-        d.addCallback(self._testForce_2)
+        d = defer.Deferred()
+        req.subscribe(d.callback)
+        builder_control.requestBuild(req)
+        d.addCallback(self._testRequest_2)
+        # we use the same check-the-results code as testForce
         return d
 
-    def _testForce_2(self, build_control):
+    def _testRequest_2(self, build_control):
         self.failUnless(providedBy(build_control, interfaces.IBuildControl))
         d = build_control.getStatus().waitUntilFinished()
-        d.addCallback(self._testForce_3)
+        d.addCallback(self._testRequest_3)
         return d
 
-    def _testForce_3(self, bs):
+    def _testRequest_3(self, bs):
         self.failUnless(providedBy(bs, interfaces.IBuildStatus))
         self.failUnless(bs.isFinished())
         self.failUnlessEqual(bs.getResults(), SUCCESS)
         #self.failUnlessEqual(bs.getResponsibleUsers(), ["bob"]) # TODO
         self.failUnlessEqual(bs.getChanges(), [])
         #self.failUnlessEqual(bs.getReason(), "forced") # TODO
-
-    def testRequest(self):
-        m = self.master
-        m.loadConfig(config)
-        m.startService()
-        d = self.connectSlave()
-        d.addCallback(self._testRequest_1)
-        return maybeWait(d)
-    def _testRequest_1(self, res):
-        c = interfaces.IControl(self.master)
-        req = base.BuildRequest("I was bored", SourceStamp())
-        builder_control = c.getBuilder("force")
-        d = defer.Deferred()
-        req.subscribe(d.callback)
-        builder_control.requestBuild(req)
-        d.addCallback(self._testForce_2)
-        # we use the same check-the-results code as testForce
-        return d

Index: test_run.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_run.py,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- test_run.py	24 Nov 2006 07:16:35 -0000	1.41
+++ test_run.py	24 Nov 2006 07:19:55 -0000	1.42
@@ -174,19 +174,16 @@
 
         self.failUnlessEqual(bs.getResults(), builder.FAILURE)
 
-
-    def testIdle1(self):
-        # disconnect the slave before the build starts
-        d = self.shutdownAllSlaves() # dies before it gets started
-        d.addCallback(self._testIdle1_1)
+    def submitBuild(self):
+        ss = SourceStamp()
+        br = BuildRequest("forced build", ss, "dummy")
+        self.control.getBuilder("dummy").requestBuild(br)
+        d = defer.Deferred()
+        def _started(bc):
+            br.unsubscribe(_started)
+            d.callback(bc)
+        br.subscribe(_started)
         return d
-    def _testIdle1_1(self, res):
-        # trying to force a build now will cause an error. Regular builds
-        # just wait for the slave to re-appear, but forced builds that
-        # cannot be run right away trigger NoSlaveErrors
-        fb = self.control.getBuilder("dummy").forceBuild
-        self.failUnlessRaises(interfaces.NoSlaveError,
-                              fb, None, "forced build")
 
     def testIdle2(self):
         # now suppose the slave goes missing
@@ -220,7 +217,7 @@
         # least 3 seconds to complete, and this batch of commands must
         # complete within that time.
         #
-        d = self.control.getBuilder("dummy").forceBuild(None, "forced build")
+        d = self.submitBuild()
         d.addCallback(self._testBuild1_1)
         return maybeWait(d)
 
@@ -249,7 +246,7 @@
 
     def testBuild2(self):
         # this next sequence is timing-dependent
-        d = self.control.getBuilder("dummy").forceBuild(None, "forced build")
+        d = self.submitBuild()
         d.addCallback(self._testBuild1_1)
         return maybeWait(d, 30)
     testBuild2.timeout = 30
@@ -279,7 +276,7 @@
 
     def testBuild3(self):
         # this next sequence is timing-dependent
-        d = self.control.getBuilder("dummy").forceBuild(None, "forced build")
+        d = self.submitBuild()
         d.addCallback(self._testBuild3_1)
         return maybeWait(d, 30)
     testBuild3.timeout = 30
@@ -306,7 +303,7 @@
 
     def testBuild4(self):
         # this next sequence is timing-dependent
-        d = self.control.getBuilder("dummy").forceBuild(None, "forced build")
+        d = self.submitBuild()
         d.addCallback(self._testBuild4_1)
         return maybeWait(d, 30)
     testBuild4.timeout = 30
@@ -331,7 +328,7 @@
 
     def testInterrupt(self):
         # this next sequence is timing-dependent
-        d = self.control.getBuilder("dummy").forceBuild(None, "forced build")
+        d = self.submitBuild()
         d.addCallback(self._testInterrupt_1)
         return maybeWait(d, 30)
     testInterrupt.timeout = 30





More information about the Commits mailing list