[svn r38098] A test and typo discovered by that test.

--HG--
branch : trunk
This commit is contained in:
fijal 2007-02-07 19:44:49 +01:00
parent 77b8a010c5
commit ecd605e3b2
2 changed files with 20 additions and 1 deletions

View File

@ -34,7 +34,7 @@ class MasterNode(object):
self.reporter(repevent.SendItem(self.channel, item))
except IOError:
print "Sending error, channel IOError"
print self.channel._getremoterror()
print self.channel._getremoteerror()
# XXX: this should go as soon as we'll have proper detection
# of hanging nodes and such
raise

View File

@ -39,6 +39,16 @@ class DummyChannel(object):
assert py.std.marshal.dumps(item)
self.sent.append(item)
class NonWorkingChannel(object):
def setcallback(self, func):
pass
def send(self, item):
raise IOError
def _getremoteerror(self):
return "blah"
class Item(py.test.Item):
def _get_collector_trail(self):
return (self.name,)
@ -62,6 +72,15 @@ def test_masternode():
assert received[0].outcome.passed
assert not received[1].outcome.passed
def test_masternode_nonworking_channel():
ch = NonWorkingChannel()
reportlist = []
mnode = MasterNode(ch, reportlist.append)
cap = py.io.StdCaptureFD()
py.test.raises(IOError, 'mnode.send(Item("ok"))')
out, err = cap.reset()
assert out.find("blah") != -1
def test_sending_two_noes():
# XXX fijal: this test previously tested that the second
# item result would not get send. why? did i miss