[py-svn] r38098 - in py/trunk/py/test/rsession: . testing

fijal at codespeak.net fijal at codespeak.net
Wed Feb 7 19:44:55 CET 2007


Author: fijal
Date: Wed Feb  7 19:44:49 2007
New Revision: 38098

Modified:
   py/trunk/py/test/rsession/master.py
   py/trunk/py/test/rsession/testing/test_master.py
Log:
A test and typo discovered by that test.


Modified: py/trunk/py/test/rsession/master.py
==============================================================================
--- py/trunk/py/test/rsession/master.py	(original)
+++ py/trunk/py/test/rsession/master.py	Wed Feb  7 19:44:49 2007
@@ -34,7 +34,7 @@
                 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

Modified: py/trunk/py/test/rsession/testing/test_master.py
==============================================================================
--- py/trunk/py/test/rsession/testing/test_master.py	(original)
+++ py/trunk/py/test/rsession/testing/test_master.py	Wed Feb  7 19:44:49 2007
@@ -39,6 +39,16 @@
         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 @@
     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


More information about the py-svn mailing list