[Buildbot-commits] buildbot/buildbot/test test_changes.py,1.3,1.4 test_web.py,1.16,1.17
Brian Warner
warner at users.sourceforge.net
Tue May 17 03:36:57 UTC 2005
Update of /cvsroot/buildbot/buildbot/buildbot/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1572/buildbot/test
Modified Files:
test_changes.py test_web.py
Log Message:
Revision: arch at buildbot.sf.net--2004/buildbot--dev--0--patch-183
Creator: Brian Warner <warner at monolith.lothar.com>
fix some minor test problems
* buildbot/test/test_web.py (WebTest.tearDown): factor out master
shutdown
(WebTest.test_logfile): make sure master gets shut down, silences
some "unclean reactor" test errors
* buildbot/test/test_changes.py (Sender.tearDown): spin the
reactor once after shutdown, something in certain versions of
Twisted trigger a test failure. 1.3.0 is ok, 2.0.0 fails, 2.0.1pre
fails, svn-trunk is ok.
Index: test_changes.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_changes.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- test_changes.py 4 May 2005 02:09:38 -0000 1.3
+++ test_changes.py 17 May 2005 03:36:54 -0000 1.4
@@ -2,7 +2,7 @@
from twisted.trial import unittest
dr = unittest.deferredResult
-from twisted.internet import defer
+from twisted.internet import defer, reactor
from twisted.python import log
from buildbot import master
@@ -58,6 +58,16 @@
self.failUnlessEqual(c3.comments, "mixed changes")
self.failUnlessEqual(c3.who, "alice")
+config_empty = """
+from buildbot.changes import pb
+c = {}
+c['bots'] = []
+c['builders'] = []
+c['sources'] = []
+c['slavePortnum'] = 0
+BuildmasterConfig = c
+"""
+
config_sender = """
from buildbot.changes import pb
c = {}
@@ -74,9 +84,15 @@
def tearDown(self):
d = defer.maybeDeferred(self.master.stopService)
dr(d)
+ # TODO: something in Twisted-2.0.0 (and probably 2.0.1) doesn't shut
+ # down the Broker listening socket when it's supposed to.
+ # Twisted-1.3.0, and current SVN (which will be post-2.0.1) are ok.
+ # This iterate() is a quick hack to deal with the problem. I need to
+ # investigate more thoroughly and find a better solution.
+ reactor.iterate()
def testSender(self):
- d = self.master.loadConfig(config_sender)
+ d = self.master.loadConfig(config_empty)
dr(d)
self.master.startService()
# TODO: BuildMaster.loadChanges replaces the change_svc object, so we
Index: test_web.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_web.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- test_web.py 16 May 2005 00:16:28 -0000 1.16
+++ test_web.py 17 May 2005 03:36:54 -0000 1.17
@@ -72,6 +72,8 @@
class WebTest(unittest.TestCase):
+ master = None
+
def failUnlessIn(self, substr, string):
self.failUnless(string.find(substr) != -1)
@@ -79,6 +81,9 @@
# grr.
from twisted.protocols import http
http._logDateTimeStop()
+ if self.master:
+ d = self.master.stopService()
+ dr(d)
def find_waterfall(self, master):
return filter(lambda child: isinstance(child, html.Waterfall),
@@ -97,7 +102,7 @@
}
"""
os.mkdir("test_web1")
- m = ConfiguredMaster("test_web1", config)
+ self.master = m = ConfiguredMaster("test_web1", config)
m.startService()
# hack to find out what randomly-assigned port it is listening on
port = list(self.find_waterfall(m)[0])[0]._port.getHost().port
@@ -106,7 +111,6 @@
page = dr(d, 10)
#print page
self.failUnless(page)
- dr(m.stopService())
def test_webPathname(self):
# running a t.web.distrib server over a UNIX socket
@@ -123,7 +127,7 @@
}
"""
os.mkdir("test_web2")
- m = ConfiguredMaster("test_web2", config)
+ self.master = m = ConfiguredMaster("test_web2", config)
m.startService()
p = DistribUNIX("test_web2/.web-pb")
@@ -133,7 +137,6 @@
#print page
self.failUnless(page)
dr(p.shutdown())
- dr(m.stopService())
def test_webPathname_port(self):
@@ -149,7 +152,7 @@
}
"""
os.mkdir("test_web3")
- m = ConfiguredMaster("test_web3", config)
+ self.master = m = ConfiguredMaster("test_web3", config)
m.startService()
dport = list(self.find_waterfall(m)[0])[0]._port.getHost().port
@@ -159,7 +162,6 @@
page = dr(d, 10)
self.failUnlessIn("BuildBot", page)
dr(p.shutdown())
- dr(m.stopService())
def test_waterfall(self):
# this is the right way to configure the Waterfall status
@@ -176,7 +178,7 @@
"""
os.mkdir("test_web4")
os.mkdir("my-maildir"); os.mkdir("my-maildir/new")
- m = ConfiguredMaster("test_web4", config1)
+ self.master = m = ConfiguredMaster("test_web4", config1)
m.startService()
# hack to find out what randomly-assigned port it is listening on
port = list(self.find_waterfall(m)[0])[0]._port.getHost().port
@@ -207,8 +209,6 @@
self.failUnlessIn("<li>Syncmail mailing list in maildir " +
"my-maildir</li>", changes)
- dr(m.stopService())
-
def test_logfile(self):
config = """
from buildbot.status import html
@@ -224,7 +224,7 @@
}
"""
os.mkdir("test_web5")
- m = ConfiguredMaster("test_web5", config)
+ self.master = m = ConfiguredMaster("test_web5", config)
m.startService()
# hack to find out what randomly-assigned port it is listening on
port = list(self.find_waterfall(m)[0])[0]._port.getHost().port
More information about the Commits
mailing list