assertraises behaviour

Andrea Crotti andrea.crotti.0 at
Wed Jul 18 01:31:24 CEST 2012

To clarify my "problem", I just thought that assertRaises if used as 
context manager should behave as following:
- keep going if the exception declared is raised
- re-raise an error even if catched after the declared exception was catched

I was also confused by the doc a bit:
"Test that an exception is raised when /callable/ is called with any 
positional or keyword arguments that are also passed to assertRaises() 
The test passes if /exception/ is raised, is an error if another 
exception is raised, or fails if no exception is raised"

which speaks about when it's not used as a context manager..

I understand why it's not possible and it's not a big issue though..
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list