[Buildbot-commits] buildbot/buildbot/test test_changes.py, 1.11, 1.12 test_config.py, 1.45, 1.46 test_control.py, 1.16, 1.17 test_dependencies.py, 1.7, 1.8 test_locks.py, 1.9, 1.10 test_properties.py, 1.9, 1.10 test_run.py, 1.45, 1.46 test_slaves.py, 1.10, 1.11 test_status.py, 1.42, 1.43 test_steps.py, 1.41, 1.42 test_vc.py, 1.75, 1.76 test_web.py, 1.45, 1.46

Brian Warner warner at users.sourceforge.net
Wed Aug 1 20:31:29 UTC 2007


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

Modified Files:
	test_changes.py test_config.py test_control.py 
	test_dependencies.py test_locks.py test_properties.py 
	test_run.py test_slaves.py test_status.py test_steps.py 
	test_vc.py test_web.py 
Log Message:
[project @ replace c['sources'] with c['change_source']]

Original author: warner at lothar.com
Date: 2007-07-28 20:03:12+00:00

Index: test_changes.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_changes.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- test_changes.py	27 Jul 2007 10:13:55 -0000	1.11
+++ test_changes.py	1 Aug 2007 20:31:26 -0000	1.12
@@ -99,7 +99,6 @@
 BuildmasterConfig = c = {}
 c['slaves'] = []
 c['builders'] = []
-c['sources'] = []
 c['schedulers'] = []
 c['slavePortnum'] = 0
 """
@@ -107,7 +106,7 @@
 config_sender = config_empty + \
 """
 from buildbot.changes import pb
-c['sources'] = [pb.PBChangeSource(port=None)]
+c['change_source'] = pb.PBChangeSource(port=None)
 """
 
 class Sender(unittest.TestCase):

Index: test_config.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_config.py,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- test_config.py	27 Jul 2007 10:13:55 -0000	1.45
+++ test_config.py	1 Aug 2007 20:31:26 -0000	1.46
@@ -7,13 +7,6 @@
 from twisted.python import failure
 from twisted.internet import defer
 
-cvstoys = None
-try:
-    import cvstoys
-    from buildbot.changes.freshcvs import FreshCVSSource
-except ImportError:
-    pass
-
 from buildbot.master import BuildMaster
 from buildbot import scheduler
 from twisted.application import service, internet
@@ -22,6 +15,8 @@
 from twisted.web.distrib import ResourcePublisher
 from buildbot.process.builder import Builder
 from buildbot.process.factory import BasicBuildFactory
+from buildbot.changes.pb import PBChangeSource
+from buildbot.changes.mail import SyncmailMaildirSource
 from buildbot.steps.source import CVS, Darcs
 from buildbot.steps.shell import Compile, Test, ShellCommand
 from buildbot.status import base
@@ -37,7 +32,6 @@
 """
 BuildmasterConfig = c = {}
 c['slaves'] = []
-c['sources'] = []
 c['schedulers'] = []
 c['builders'] = []
 c['slavePortnum'] = 9999
@@ -52,7 +46,6 @@
 from buildbot.slave import BuildSlave
 BuildmasterConfig = c = {}
 c['slaves'] = [BuildSlave('bot1', 'pw1')]
-c['sources'] = []
 c['schedulers'] = []
 c['slavePortnum'] = 9999
 f1 = BasicBuildFactory('cvsroot', 'cvsmodule')
@@ -162,7 +155,6 @@
 from buildbot.slave import BuildSlave
 c = {}
 c['slaves'] = [BuildSlave('bot1', 'pw1')]
-c['sources'] = []
 c['schedulers'] = []
 f1 = BasicBuildFactory('cvsroot', 'cvsmodule')
 c['builders'] = [
@@ -186,7 +178,6 @@
 from buildbot.slave import BuildSlave
 c = {}
 c['slaves'] = [BuildSlave('bot1', 'pw1')]
-c['sources'] = []
 c['schedulers'] = []
 l1 = MasterLock('lock1')
 l2 = MasterLock('lock1') # duplicate lock name
@@ -209,7 +200,6 @@
 from buildbot.slave import BuildSlave
 c = {}
 c['slaves'] = [BuildSlave('bot1', 'pw1')]
-c['sources'] = []
 c['schedulers'] = []
 l1 = MasterLock('lock1')
 l2 = SlaveLock('lock1') # duplicate lock name
@@ -232,7 +222,6 @@
 from buildbot.slave import BuildSlave
 c = {}
 c['slaves'] = [BuildSlave('bot1', 'pw1')]
-c['sources'] = []
 c['schedulers'] = []
 l1 = MasterLock('lock1')
 l2 = MasterLock('lock1') # duplicate lock name
@@ -255,7 +244,6 @@
 from buildbot.slave import BuildSlave
 c = {}
 c['slaves'] = [BuildSlave('bot1', 'pw1')]
-c['sources'] = []
 c['schedulers'] = []
 f1 = BasicBuildFactory('cvsroot', 'cvsmodule')
 l1 = MasterLock('lock1')
@@ -277,7 +265,6 @@
 from buildbot.slave import BuildSlave
 c = {}
 c['slaves'] = [BuildSlave('bot1', 'pw1')]
-c['sources'] = []
 c['schedulers'] = []
 f1 = BasicBuildFactory('cvsroot', 'cvsmodule')
 l1 = MasterLock('lock1')
@@ -301,7 +288,6 @@
 from buildbot.slave import BuildSlave
 c = {}
 c['slaves'] = [BuildSlave('bot1', 'pw1')]
-c['sources'] = []
 c['schedulers'] = []
 l1 = MasterLock('lock1')
 l2 = MasterLock('lock2')
@@ -326,7 +312,6 @@
 from buildbot.slave import BuildSlave
 c = {}
 c['slaves'] = [BuildSlave('bot1', 'pw1')]
-c['sources'] = []
 c['schedulers'] = []
 l1 = MasterLock('lock1')
 l2 = MasterLock('lock2')
@@ -351,7 +336,6 @@
 from buildbot.slave import BuildSlave
 c = {}
 c['slaves'] = [BuildSlave('bot1', 'pw1')]
-c['sources'] = []
 c['schedulers'] = []
 l1 = MasterLock('lock1')
 l2 = MasterLock('lock2')
@@ -375,7 +359,6 @@
 from buildbot.slave import BuildSlave
 c = {}
 c['slaves'] = [BuildSlave('bot1', 'pw1')]
-c['sources'] = []
 f1 = BasicBuildFactory('cvsroot', 'cvsmodule')
 b1 = {'name':'builder1', 'slavename':'bot1',
       'builddir':'workdir', 'factory':f1}
@@ -485,7 +468,7 @@
         self.failIf(p is ports[0],
                     "slave port was unchanged but configuration was changed")
 
-    def testBots(self):
+    def testSlaves(self):
         master = self.buildmaster
         master.loadChanges()
         master.loadConfig(emptyCfg)
@@ -518,54 +501,97 @@
                               "bot2": "pw2"})
 
 
-    def testSources(self):
-        if not cvstoys:
-            raise unittest.SkipTest("this test needs CVSToys installed")
+    def testChangeSource(self):
         master = self.buildmaster
         master.loadChanges()
         master.loadConfig(emptyCfg)
         self.failUnlessEqual(list(master.change_svc), [])
 
-        self.sourcesCfg = emptyCfg + \
+        sourcesCfg = emptyCfg + \
 """
-from buildbot.changes.freshcvs import FreshCVSSource
-s1 = FreshCVSSource('cvs.example.com', 1000, 'pname', 'spass',
-                    prefix='Prefix/')
-c['sources'] = [s1]
+from buildbot.changes.pb import PBChangeSource
+c['change_source'] = PBChangeSource()
 """
 
-        d = master.loadConfig(self.sourcesCfg)
-        d.addCallback(self._testSources_1)
-        return d
+        d = master.loadConfig(sourcesCfg)
+        def _check1(res):
+            self.failUnlessEqual(len(list(self.buildmaster.change_svc)), 1)
+            s1 = list(self.buildmaster.change_svc)[0]
+            self.failUnless(isinstance(s1, PBChangeSource))
+            self.failUnlessEqual(s1, list(self.buildmaster.change_svc)[0])
+            self.failUnless(s1.parent)
 
-    def _testSources_1(self, res):
-        self.failUnlessEqual(len(list(self.buildmaster.change_svc)), 1)
-        s1 = list(self.buildmaster.change_svc)[0]
-        self.failUnless(isinstance(s1, FreshCVSSource))
-        self.failUnlessEqual(s1.host, "cvs.example.com")
-        self.failUnlessEqual(s1.port, 1000)
-        self.failUnlessEqual(s1.prefix, "Prefix/")
-        self.failUnlessEqual(s1, list(self.buildmaster.change_svc)[0])
-        self.failUnless(s1.parent)
+            # verify that unchanged sources are not interrupted
+            d1 = self.buildmaster.loadConfig(sourcesCfg)
+
+            def _check2(res):
+                self.failUnlessEqual(len(list(self.buildmaster.change_svc)), 1)
+                s2 = list(self.buildmaster.change_svc)[0]
+                self.failUnlessIdentical(s1, s2)
+                self.failUnless(s1.parent)
+            d1.addCallback(_check2)
+            return d1
+        d.addCallback(_check1)
+
+        # make sure we can get rid of the sources too
+        d.addCallback(lambda res: self.buildmaster.loadConfig(emptyCfg))
+
+        def _check3(res):
+            self.failUnlessEqual(list(self.buildmaster.change_svc), [])
+        d.addCallback(_check3)
 
-        # verify that unchanged sources are not interrupted
-        d = self.buildmaster.loadConfig(self.sourcesCfg)
-        d.addCallback(self._testSources_2, s1)
         return d
 
-    def _testSources_2(self, res, s1):
-        self.failUnlessEqual(len(list(self.buildmaster.change_svc)), 1)
-        s2 = list(self.buildmaster.change_svc)[0]
-        self.failUnlessIdentical(s1, s2)
-        self.failUnless(s1.parent)
+    def testChangeSources(self):
+        # make sure we can accept a list
+        master = self.buildmaster
+        master.loadChanges()
+        master.loadConfig(emptyCfg)
+        self.failUnlessEqual(list(master.change_svc), [])
 
-        # make sure we can get rid of the sources too
-        d = self.buildmaster.loadConfig(emptyCfg)
-        d.addCallback(self._testSources_3)
+        sourcesCfg = emptyCfg + \
+"""
+from buildbot.changes.pb import PBChangeSource
+from buildbot.changes.mail import SyncmailMaildirSource
+c['change_source'] = [PBChangeSource(),
+                     SyncmailMaildirSource('.'),
+                    ]
+"""
+
+        d = master.loadConfig(sourcesCfg)
+        def _check1(res):
+            self.failUnlessEqual(len(list(self.buildmaster.change_svc)), 2)
+            s1,s2 = list(self.buildmaster.change_svc)
+            if isinstance(s2, PBChangeSource):
+                s1,s2 = s2,s1
+            self.failUnless(isinstance(s1, PBChangeSource))
+            self.failUnless(s1.parent)
+            self.failUnless(isinstance(s2, SyncmailMaildirSource))
+            self.failUnless(s2.parent)
+        d.addCallback(_check1)
         return d
 
-    def _testSources_3(self, res):
-        self.failUnlessEqual(list(self.buildmaster.change_svc), [])
+    def testSources(self):
+        # test backwards compatibility. c['sources'] is deprecated.
+        master = self.buildmaster
+        master.loadChanges()
+        master.loadConfig(emptyCfg)
+        self.failUnlessEqual(list(master.change_svc), [])
+
+        sourcesCfg = emptyCfg + \
+"""
+from buildbot.changes.pb import PBChangeSource
+c['sources'] = [PBChangeSource()]
+"""
+
+        d = master.loadConfig(sourcesCfg)
+        def _check1(res):
+            self.failUnlessEqual(len(list(self.buildmaster.change_svc)), 1)
+            s1 = list(self.buildmaster.change_svc)[0]
+            self.failUnless(isinstance(s1, PBChangeSource))
+            self.failUnless(s1.parent)
+        d.addCallback(_check1)
+        return d
 
     def shouldBeFailure(self, res, *expected):
         self.failUnless(isinstance(res, failure.Failure),
@@ -1130,7 +1156,6 @@
 from buildbot.slave import BuildSlave
 BuildmasterConfig = c = {}
 c['slaves'] = [BuildSlave('bot1', 'pw1')]
-c['sources'] = []
 c['schedulers'] = []
 c['slavePortnum'] = 9999
 f1 = BuildFactory([ShellCommand(command='echo yes'),

Index: test_control.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_control.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- test_control.py	27 Jul 2007 10:13:55 -0000	1.16
+++ test_control.py	1 Aug 2007 20:31:27 -0000	1.17
@@ -25,7 +25,6 @@
     ])
 c = {}
 c['slaves'] = [BuildSlave('bot1', 'sekrit')]
-c['sources'] = []
 c['schedulers'] = []
 c['builders'] = [{'name': 'force', 'slavename': 'bot1',
                   'builddir': 'force-dir', 'factory': f1}]

Index: test_dependencies.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_dependencies.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- test_dependencies.py	27 Jul 2007 10:13:55 -0000	1.7
+++ test_dependencies.py	1 Aug 2007 20:31:27 -0000	1.8
@@ -17,7 +17,6 @@
 
 BuildmasterConfig = c = {}
 c['slaves'] = [BuildSlave('bot1', 'sekrit'), BuildSlave('bot2', 'sekrit')]
-c['sources'] = []
 c['schedulers'] = []
 c['slavePortnum'] = 0
 

Index: test_locks.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_locks.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- test_locks.py	27 Jul 2007 10:13:55 -0000	1.9
+++ test_locks.py	1 Aug 2007 20:31:27 -0000	1.10
@@ -289,7 +289,6 @@
 
 BuildmasterConfig = c = {}
 c['slaves'] = [BuildSlave('bot1', 'sekrit'), BuildSlave('bot2', 'sekrit')]
-c['sources'] = []
 c['schedulers'] = []
 c['slavePortnum'] = 0
 

Index: test_properties.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_properties.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- test_properties.py	27 Jul 2007 10:13:55 -0000	1.9
+++ test_properties.py	1 Aug 2007 20:31:27 -0000	1.10
@@ -140,7 +140,6 @@
 
 BuildmasterConfig = c = {}
 c['slaves'] = [BuildSlave('bot1', 'sekrit')]
-c['sources'] = []
 c['schedulers'] = []
 c['slavePortnum'] = 0
 

Index: test_run.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_run.py,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- test_run.py	27 Jul 2007 10:13:55 -0000	1.45
+++ test_run.py	1 Aug 2007 20:31:27 -0000	1.46
@@ -27,7 +27,6 @@
 
 BuildmasterConfig = c = {}
 c['slaves'] = [BuildSlave('bot1', 'sekrit')]
-c['sources'] = []
 c['schedulers'] = []
 c['builders'] = []
 c['builders'].append({'name':'quick', 'slavename':'bot1',

Index: test_slaves.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_slaves.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- test_slaves.py	27 Jul 2007 10:13:55 -0000	1.10
+++ test_slaves.py	1 Aug 2007 20:31:27 -0000	1.11
@@ -19,7 +19,6 @@
 BuildmasterConfig = c = {}
 c['slaves'] = [BuildSlave('bot1', 'sekrit'), BuildSlave('bot2', 'sekrit'),
                BuildSlave('bot3', 'sekrit')]
-c['sources'] = []
 c['schedulers'] = []
 c['slavePortnum'] = 0
 c['schedulers'] = []
@@ -197,7 +196,6 @@
 
 BuildmasterConfig = c = {}
 c['slaves'] = [BuildSlave('bot1', 'sekrit')]
-c['sources'] = []
 c['schedulers'] = []
 c['slavePortnum'] = 0
 c['schedulers'] = []

Index: test_status.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_status.py,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- test_status.py	27 Jul 2007 10:13:55 -0000	1.42
+++ test_status.py	1 Aug 2007 20:31:27 -0000	1.43
@@ -741,7 +741,6 @@
 
 BuildmasterConfig = c = {}
 c['slaves'] = [BuildSlave('bot1', 'sekrit')]
-c['sources'] = []
 c['schedulers'] = []
 c['builders'] = []
 c['builders'].append({'name':'quick', 'slavename':'bot1',

Index: test_steps.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_steps.py,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- test_steps.py	27 Jul 2007 10:13:55 -0000	1.41
+++ test_steps.py	1 Aug 2007 20:31:27 -0000	1.42
@@ -317,7 +317,6 @@
     factory.s(VersionCheckingStep),
     ])
 c['slaves'] = [BuildSlave('bot1', 'sekrit')]
-c['sources'] = []
 c['schedulers'] = []
 c['builders'] = [{'name':'quick', 'slavename':'bot1',
                   'builddir': 'quickdir', 'factory': f1}]

Index: test_vc.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_vc.py,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -d -r1.75 -r1.76
--- test_vc.py	27 Jul 2007 10:13:55 -0000	1.75
+++ test_vc.py	1 Aug 2007 20:31:27 -0000	1.76
@@ -105,7 +105,6 @@
     ])
 c = {}
 c['slaves'] = [BuildSlave('bot1', 'sekrit')]
-c['sources'] = []
 c['schedulers'] = []
 c['builders'] = [{'name': 'vc', 'slavename': 'bot1',
                   'builddir': 'vc-dir', 'factory': f1}]

Index: test_web.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_web.py,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- test_web.py	27 Jul 2007 10:13:55 -0000	1.45
+++ test_web.py	1 Aug 2007 20:31:27 -0000	1.46
@@ -37,7 +37,6 @@
 from buildbot.status import html
 BuildmasterConfig = c = {
     'slaves': [],
-    'sources': [],
     'schedulers': [],
     'builders': [],
     'slavePortnum': 0,
@@ -196,7 +195,7 @@
         # this is the right way to configure the Waterfall status
         config1 = base_config + """
 from buildbot.changes import mail
-c['sources'] = [mail.SyncmailMaildirSource('my-maildir')]
+c['change_source'] = mail.SyncmailMaildirSource('my-maildir')
 c['status'] = [html.Waterfall(http_port=0, robots_txt=%s)]
 """ % repr(self.robots_txt)
 
@@ -292,7 +291,7 @@
 
 BuildmasterConfig = c = {}
 c['slaves'] = [BuildSlave('bot1', 'sekrit'), BuildSlave('bot2', 'sekrit')]
-c['sources'] = [DummyChangeSource()]
+c['change_source'] = DummyChangeSource()
 c['schedulers'] = [DiscardScheduler('discard', None, 60, ['b1'])]
 c['slavePortnum'] = 0
 c['status'] = [html.Waterfall(http_port=0)]
@@ -390,7 +389,6 @@
 f1 = BasicBuildFactory('cvsroot', 'cvsmodule')
 BuildmasterConfig = {
     'slaves': [BuildSlave('bot1', 'passwd1')],
-    'sources': [],
     'schedulers': [],
     'builders': [{'name': 'builder1', 'slavename': 'bot1',
                   'builddir':'workdir', 'factory':f1}],





More information about the Commits mailing list