R. David Murray <rdmur...@bitdance.com> added the comment:

To be pedantic, are not macros, they are context managers :)

Your first case is not something I would have thought of coding.  In the 
to_raise=True case, the subTest is failing because an exception is raised 
inside its scope.  In the to_raise=False case, the subTest scope has already 
ended before the assertRaises scope completes and raises its error because no 
exception was raised.  That is, there is no subTest in effect to be reported 
when that failure occurs.

In your second case, when to_raise is False, no exception is raised, so the 
assertRaises correctly fails, and the subtest reports that to_raise is False.  
When to_raise is true, the exception is raised, the assertRaises passes and so 
does the subtest.  In other words, I can't reproduce the problem you cite for 
the second case.  Looking at what you pasted, it looks like you confused a 
test_assert_outer report with a test_report_inner report.

So, as far as I can see, there's nothing broken here, everything is working 
according to the documentation :)

----------
nosy: +r.david.murray

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32213>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to