[Buildbot-commits] buildbot/buildbot/test test_properties.py, 1.12, 1.13

Brian Warner warner at users.sourceforge.net
Thu May 22 22:11:38 UTC 2008


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

Modified Files:
	test_properties.py 
Log Message:
[project @ #227:scheduler-property-in-build.patch]
Patch by Dossy Shiobara <dossy at panoptic.com>: It is useful to know
the name of the scheduler that initiated a build request, i.e., to
conditionally FileUpload the results of a Nightly scheduled build.
This patch passes the Scheduler along the BuildRequest chain so
that Build can setProperty("scheduler", self.scheduler.name) in
Build.setupStatus().

Original author: dustin at v.igoro.us
Date: 2008-04-04 02:54:25+00:00

Index: test_properties.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_properties.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- test_properties.py	18 Mar 2008 20:06:12 -0000	1.12
+++ test_properties.py	22 May 2008 22:11:36 -0000	1.13
@@ -23,6 +23,8 @@
     slave = FakeSlave()
     def getSlaveCommandVersion(self, command, oldversion=None):
         return "1.10"
+class FakeScheduler:
+    name = "fakescheduler"
 
 class Interpolate(unittest.TestCase):
     def setUp(self):
@@ -52,6 +54,7 @@
         cmd = c._interpolateProperties(c.command)
         self.failUnlessEqual(cmd,
                              ["tar", "czf", "build-47.tar.gz", "source"])
+        self.failUnlessEqual(self.build.getProperty("scheduler"), "none")
 
     def testWorkdir(self):
         self.build.setProperty("revision", 47)
@@ -117,6 +120,25 @@
         self.failUnlessEqual(cmd,
                              ["touch", "build-5", "builder-fakebuilder"])
 
+class SchedulerTest(unittest.TestCase):
+    def setUp(self):
+        self.builder = FakeBuilder()
+        self.builder_status = builder.BuilderStatus("fakebuilder")
+        self.builder_status.basedir = "test_properties"
+        self.builder_status.nextBuildNumber = 5
+        rmdirRecursive(self.builder_status.basedir)
+        os.mkdir(self.builder_status.basedir)
+        self.build_status = self.builder_status.newBuild()
+        req = base.BuildRequest("reason", SourceStamp(branch="branch2",
+                                revision=1234), scheduler=FakeScheduler())
+        self.build = base.Build([req])
+        self.build.setBuilder(self.builder)
+        self.build.setupStatus(self.build_status)
+        self.build.setupSlaveBuilder(FakeSlaveBuilder())
+
+    def testWithScheduler(self):
+        self.failUnlessEqual(self.build.getProperty("scheduler"),
+                             "fakescheduler")
 
 run_config = """
 from buildbot.process import factory





More information about the Commits mailing list