[Buildbot-commits] buildbot/buildbot/test test_runner.py,1.8,1.9 test_scheduler.py,1.3,1.4

Brian Warner warner at users.sourceforge.net
Thu Aug 11 20:21:34 UTC 2005


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

Modified Files:
	test_runner.py test_scheduler.py 
Log Message:
Revision: arch at buildbot.sf.net--2004/buildbot--dev--0--patch-281
Creator:  Brian Warner <warner at monolith.lothar.com>

add --builder control to 'buildbot try'

	* docs/buildbot.texinfo (try): document both --builder and
	'try_builders' in .buildbot/options
	* buildbot/scripts/runner.py (TryOptions): add --builder,
	accumulate the values into opts['builders']
	* buildbot/scripts/tryclient.py (Try.__init__): set builders
	* buildbot/test/test_runner.py (Try): add some quick tests to make
	sure 'buildbot try --options' and .buildbot/options get parsed
	* buildbot/test/test_scheduler.py (Scheduling.testTryUserpass):
	use --builder control

--This line, and those below, will be ignored--
Files to commit:
   <can't compute list>

This list might be incomplete or outdated if editing the log
message was not invoked from an up-to-date changes buffer!


Index: test_runner.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_runner.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- test_runner.py	22 May 2005 02:16:13 -0000	1.8
+++ test_runner.py	11 Aug 2005 20:21:30 -0000	1.9
@@ -3,9 +3,9 @@
 
 from twisted.trial import unittest
 from twisted.python import runtime
-import os, os.path
+import os, os.path, shutil
 
-from buildbot.scripts import runner
+from buildbot.scripts import runner, tryclient
 
 class Options(unittest.TestCase):
     optionsFile = "SDFsfsFSdfsfsFSD"
@@ -191,3 +191,49 @@
 
         make = open(os.path.join(basedir, "Makefile.sample"), "rt").read()
         self.failUnlessEqual(make, oldmake, "*should* rewrite Makefile.sample")
+
+class Try(unittest.TestCase):
+    # test some aspects of the 'buildbot try' command
+    def makeOptions(self, contents):
+        if os.path.exists(".buildbot"):
+            shutil.rmtree(".buildbot")
+        os.mkdir(".buildbot")
+        open(os.path.join(".buildbot", "options"), "w").write(contents)
+
+    def testGetopt1(self):
+        opts = "try_connect = 'ssh'\n" + "try_builders = ['a']\n"
+        self.makeOptions(opts)
+        config = runner.TryOptions()
+        config.parseOptions([])
+        t = tryclient.Try(config)
+        self.failUnlessEqual(t.connect, "ssh")
+        self.failUnlessEqual(t.builderNames, ['a'])
+
+    def testGetopt2(self):
+        opts = ""
+        self.makeOptions(opts)
+        config = runner.TryOptions()
+        config.parseOptions(['--connect=ssh', '--builder', 'a'])
+        t = tryclient.Try(config)
+        self.failUnlessEqual(t.connect, "ssh")
+        self.failUnlessEqual(t.builderNames, ['a'])
+
+    def testGetopt3(self):
+        opts = ""
+        self.makeOptions(opts)
+        config = runner.TryOptions()
+        config.parseOptions(['--connect=ssh',
+                             '--builder', 'a', '--builder=b'])
+        t = tryclient.Try(config)
+        self.failUnlessEqual(t.connect, "ssh")
+        self.failUnlessEqual(t.builderNames, ['a', 'b'])
+
+    def testGetopt4(self):
+        opts = "try_connect = 'ssh'\n" + "try_builders = ['a']\n"
+        self.makeOptions(opts)
+        config = runner.TryOptions()
+        config.parseOptions(['--builder=b'])
+        t = tryclient.Try(config)
+        self.failUnlessEqual(t.connect, "ssh")
+        self.failUnlessEqual(t.builderNames, ['b'])
+

Index: test_scheduler.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_scheduler.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- test_scheduler.py	11 Aug 2005 08:22:17 -0000	1.3
+++ test_scheduler.py	11 Aug 2005 20:21:30 -0000	1.4
@@ -198,6 +198,7 @@
                   'username': 'alice',
                   'passwd': 'pw1',
                   'master': "localhost:%d" % port,
+                  'builders': ["a", "b"],
                   }
         t = tryclient.Try(config)
         ss = sourcestamp.SourceStamp("branch1", "123", (1, "diff"))





More information about the Commits mailing list