[Buildbot-devel] Extending ShellCommand
Kirill Lapshin
kir at lapshin.net
Wed Jul 7 15:49:05 UTC 2004
Hello,
I just started playing with BuildBot, so want to apologize in advance
for potential FAQ.
First thing I want to congratulate developers for such a nice product.
It does require some polish, but even it is current state it is very
usable and has quite a lot of nice features missing in CruiseControl.
Thanks a lot!
I am trying to extend ShellCommand to run unittests and update status
nicely. Running unit tests works just fine, but updating status throws
an exception I can't decipher.
Here is relevant code:
class RunUnitTests(ShellCommand):
name = 'unittests'
def __init__(self, **kwargs):
ShellCommand.__init__(self, **kwargs)
self.python = kwargs['python']
def start(self):
command = self.python + ' '
command += os.path.join('cmd', 'test_all.py')
self.command = command
ShellCommand.start(self)
def startStatus(self):
verb = "testing"
self.setCurrentActivity(Event("yellow", [verb],
files={'log': self.log}))
def finishStatus(self, result):
verb = "unittests"
if type(result) == types.TupleType:
result, text_ignored = result
if result == FAILURE:
self.updateCurrentActivity(color="red", text=[verb, "failed"])
else:
self.updateCurrentActivity(color="green", text=[verb])
self.finishStatusSummary()
self.finishCurrentActivity()
What happens is startStatus() updates status to yellow 'testing' as
expected, log link works just fine, but when step is done, whole build
gets marked as successful, while unittests step still remains in yellow
'testing' mode. Hitting on log link at this point genereates following
traceback:
2004/07/06 21:16 EDT [HTTPChannel,0,127.0.0.1] Traceback (most recent
call last):
File
"/usr/lib/python2.3/site-packages/twisted/protocols/basic.py", line 223,
in dataReceived
why = self.lineReceived(line)
File
"/usr/lib/python2.3/site-packages/twisted/protocols/http.py", line 965,
in lineReceived
self.allContentReceived()
File
"/usr/lib/python2.3/site-packages/twisted/protocols/http.py", line 1006,
in allContentReceived
req.requestReceived(command, path, version)
File
"/usr/lib/python2.3/site-packages/twisted/protocols/http.py", line 557,
in requestReceived
self.process()
--- <exception caught here> ---
File "/usr/lib/python2.3/site-packages/twisted/web/server.py",
line 165, in process
self.render(resrc)
File "/usr/lib/python2.3/site-packages/twisted/web/server.py",
line 172, in render
body = resrc.render(self)
File
"/usr/lib/python2.3/site-packages/buildbot/status/event.py", line 384,
in render
data += self.content(self.getEntries(), asText)
File
"/usr/lib/python2.3/site-packages/buildbot/status/event.py", line 356,
in content
for type, entry in entries:
exceptions.TypeError: iteration over non-sequence
on line 356 of event.py entries is already None. Any ideas?
I am using buildbot 0.4.3 on Debian.
On a related note, buildbot did not like a couple of our unittests. The
whole unittesting process was dying saying that it caught signal 1. The
very same tests run just fin on the same machine, run by the same user
from the same folder. On closer examination it turned out that gnuplot
related tests were to blame. They did not do anything special, just
tested usage of Gnuplot.py, which basically spawns gnuplot process and
pipes some data into it. Any ideas why tests may run fine from shell,
but not from buildbot?
--Kirill
More information about the devel
mailing list