In a trial test case like this: ----------------------------------------------------------------------------------------------------------------------- *def testFailureFromDeferredList(self):* * d = defer.fail(ValueError('bad value'))* * return self.assertFailure(defer.gatherResults([d]), ValueError)* -----------------------------------------------------------------------------------------------------------------------
I get the following FAIL and ERROR: ----------------------------------------------------------------------------------------------------------------------- *[FAIL] * *Traceback (most recent call last):* * File "/home/gjorge/tmp/ buildbot.net/python_sandbox/local/lib/python2.7/site-packages/twisted/trial/_asynctest.py", line 74, in _eb* * raise self.failureException(output)* *twisted.trial.unittest.FailTest: * *Expected: (<type 'exceptions.ValueError'>,)* *Got:* *[Failure instance: Traceback (failure with no frames): <class 'twisted.internet.defer.FirstError'>: FirstError[#0, [Failure instance: Traceback (failure with no frames): <type 'exceptions.ValueError'>: bad value* *]]* *]* * * * =============================================================================== * *[ERROR]* *Traceback (most recent call last):* *Failure: exceptions.ValueError: bad value* ----------------------------------------------------------------------------------------------------------------------- If I try to remedy this by asserting I get a defer.FirstError instead of a ValueError: ----------------------------------------------------------------------------------------------------------------------- *def testFailureFromDeferredList(self):* * d = defer.fail(ValueError('bad value'))* * return self.assertFailure(defer.gatherResults([d]), defer.FirstError)* ----------------------------------------------------------------------------------------------------------------------- I still get an Error: ----------------------------------------------------------------------------------------------------------------------- *[ERROR]* *Traceback (most recent call last):* *Failure: exceptions.ValueError: bad value* ----------------------------------------------------------------------------------------------------------------------- Is there another way to assert ValueError was raised? Thanks, Jorge
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python