From: Mike C. F. <mcf...@us...> - 2005-09-17 05:33:00
|
Update of /cvsroot/pydispatcher/dispatch/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15076/tests Modified Files: test_dispatcher.py Log Message: Add "robust" module with single function sendRobust, which catches errors during callbacks and returns the error instances instead of propagating the error Patch bug in SafeRef deletion where traceback module has already been deleted by interpreter shutdown Make SafeRef pre-cache method name to allow for repr after cleanup of the method Index: test_dispatcher.py =================================================================== RCS file: /cvsroot/pydispatcher/dispatch/tests/test_dispatcher.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_dispatcher.py 26 Nov 2004 06:37:33 -0000 1.2 --- test_dispatcher.py 17 Sep 2005 05:32:53 -0000 1.3 *************** *** 1,4 **** from dispatch.dispatcher import * ! from dispatch import dispatcher import unittest, pprint --- 1,4 ---- from dispatch.dispatcher import * ! from dispatch import dispatcher, robust import unittest, pprint *************** *** 112,115 **** --- 112,126 ---- del result self._isclean() + def testRobust( self ): + """Test the sendRobust function""" + def fails( ): + raise ValueError( 'this' ) + a = object() + signal = 'this' + connect( fails, Any, a ) + result = robust.sendRobust('this',a, a=a) + err = result[0][1] + assert isinstance( err, ValueError ) + assert err.args == ('this',) def getSuite(): |