[issue6275] let unittest.assertRaises() return the exception object caught

2009-08-28 Thread Michael Foord
Michael Foord mich...@voidspace.org.uk added the comment: Cool. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6275 ___ ___ Python-bugs-list

[issue6275] let unittest.assertRaises() return the exception object caught

2009-08-27 Thread Kristján Valur Jónsson
Kristján Valur Jónsson krist...@ccpgames.com added the comment: Committed this much more harmless patch to the trunk as revision 74556 -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6275

[issue6275] let unittest.assertRaises() return the exception object caught

2009-07-29 Thread Raghuram Devarakonda
Changes by Raghuram Devarakonda draghu...@gmail.com: -- nosy: +draghuram ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6275 ___ ___

[issue6275] let unittest.assertRaises() return the exception object caught

2009-06-19 Thread Jean-Paul Calderone
Jean-Paul Calderone exar...@divmod.com added the comment: I just want to second Kristján's position. I've used assertRaises a lot over the years (an implementation in a third-party unit testing library) and it is extremely common that I want the exception object to perform the kind of checks he

[issue6275] let unittest.assertRaises() return the exception object caught

2009-06-14 Thread Kristján Valur Jónsson
Kristján Valur Jónsson krist...@ccpgames.com added the comment: Guido's comment is out of date. The assertRaises(exception) already returns something: A context manager. If we don't want to return the object, how about retainig it in the context manager, then? It is very awkward otherwise

[issue6275] let unittest.assertRaises() return the exception object caught

2009-06-14 Thread Michael Foord
Michael Foord mich...@voidspace.org.uk added the comment: Well, his comment was made after assertRaises had already been made a context manager. Keeping the exception attached to the context manager is an interesting suggestion and a less 'surprising' change to the API. --

[issue6275] let unittest.assertRaises() return the exception object caught

2009-06-14 Thread Michael Foord
Michael Foord mich...@voidspace.org.uk added the comment: I disagree that the regex version is half-assed though. If all you want to do is to make assertions about the exception message (the most common use case in *my* experience) it is enormously convenient. --

[issue6275] let unittest.assertRaises() return the exception object caught

2009-06-14 Thread Kristján Valur Jónsson
Kristján Valur Jónsson krist...@ccpgames.com added the comment: Uploading a slimmed down patch, with only the exc_value memeber added to the assertRaises context manager. -- Added file: http://bugs.python.org/file14298/unitest2.patch ___ Python

[issue6275] let unittest.assertRaises() return the exception object caught

2009-06-14 Thread Kristján Valur Jónsson
Kristján Valur Jónsson krist...@ccpgames.com added the comment: Ok, maybe a bad choice of words :) I don't write unittests that much, of course, but I have found that when I am writing tests for stuff such as http, I want to verify the actual error code, i.e. HTTPError.code, which is not

[issue6275] let unittest.assertRaises() return the exception object caught

2009-06-13 Thread Michael Foord
Michael Foord mich...@voidspace.org.uk added the comment: This was suggested before on Python-dev and Guido rejected it as it is an 'odd' API for a unittest assert method - none of the others return anything. -- resolution: - rejected status: open - closed

[issue6275] let unittest.assertRaises() return the exception object caught

2009-06-12 Thread Kristján Valur Jónsson
New submission from Kristján Valur Jónsson krist...@ccpgames.com: It can be useful, after a unittest.assertRaises() or assertRaisesRegexp() to be able to take a closer look at the exception that was raised. To this end, I propose returning the caught exception from these methods. Additionally,

[issue6275] let unittest.assertRaises() return the exception object caught

2009-06-12 Thread Georg Brandl
Changes by Georg Brandl ge...@python.org: -- assignee: - michael.foord nosy: +michael.foord ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6275 ___