[issue32213] assertRaises and subTest context managers cannot be nested

2017-12-04 Thread R. David Murray
Change by R. David Murray : -- resolution: -> not a bug ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https

[issue32213] assertRaises and subTest context managers cannot be nested

2017-12-04 Thread R. David Murray
R. David Murray added the comment: Yes, that's an easy mistake to make. I avoided it by only running one of the tests cases at a time, and I'll admit I had to think about it for a while to understand what was going on in your first case. -- ___ Py

[issue32213] assertRaises and subTest context managers cannot be nested

2017-12-04 Thread Paul Ganssle
Paul Ganssle added the comment: @r.david.murray So it is, my mistake. I think I was conflating issues when this first came up, and then I didn't notice that the order the test cases printed in was different than I expected. -- stage: -> resolved status: open -> closed __

[issue32213] assertRaises and subTest context managers cannot be nested

2017-12-04 Thread R. David Murray
R. David Murray 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

[issue32213] assertRaises and subTest context managers cannot be nested

2017-12-04 Thread Paul Ganssle
New submission from Paul Ganssle : The TestCase.assertRaises and TestCase.subTest macros apparently don't interact with each other well. To demonstrate, consider the following code: from unittest import TestCase class SubTestRaisesTest(TestCase): def test_assert_outer(self):