[svn r38098] A test and typo discovered by that test.
--HG-- branch : trunk
This commit is contained in:
		
							parent
							
								
									77b8a010c5
								
							
						
					
					
						commit
						ecd605e3b2
					
				|  | @ -34,7 +34,7 @@ class MasterNode(object): | ||||||
|                 self.reporter(repevent.SendItem(self.channel, item)) |                 self.reporter(repevent.SendItem(self.channel, item)) | ||||||
|         except IOError: |         except IOError: | ||||||
|             print "Sending error, channel 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 |             # XXX: this should go as soon as we'll have proper detection | ||||||
|             #      of hanging nodes and such |             #      of hanging nodes and such | ||||||
|             raise |             raise | ||||||
|  |  | ||||||
|  | @ -39,6 +39,16 @@ class DummyChannel(object): | ||||||
|         assert py.std.marshal.dumps(item) |         assert py.std.marshal.dumps(item) | ||||||
|         self.sent.append(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): | class Item(py.test.Item): | ||||||
|     def _get_collector_trail(self): |     def _get_collector_trail(self): | ||||||
|         return (self.name,) |         return (self.name,) | ||||||
|  | @ -62,6 +72,15 @@ def test_masternode(): | ||||||
|     assert received[0].outcome.passed  |     assert received[0].outcome.passed  | ||||||
|     assert not received[1].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(): | def test_sending_two_noes(): | ||||||
|     # XXX fijal: this test previously tested that the second |     # XXX fijal: this test previously tested that the second | ||||||
|     #     item result would not get send. why? did i miss |     #     item result would not get send. why? did i miss | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue