[py-dev] Is this a bug?

Tom Harris tom_harris at aapl.com.au
Fri Feb 10 02:09:47 CET 2006


I found the following whilst testing a class with py.test with a broken __repr__. 

If I call py.test with the --showlocals flag it attempts to print the locals in a failing test function. If one of these locals has a broken __repr__ (in my case it was the tested class itself, no surprise there), then the test script exits with a broken traceback due to the repr_locals() function in py.test.terminal.TerminalSession class. The call to repr should (IMHO)  catch any exception from repr and generate a default repr, say  <foo.bar instance at 0x00A96058>.

Does this need fixing? Now I know about it, it's not really a problem but it would have confused me a bit if I hadn't just written the broken repr. I'll submit a patch with a test if you like.

BTW, py.test is much cooler than unittest.

Tom Harris

- The contents of this email, and any attachments, are strictly private and confidential.
- It may contain legally privileged or sensitive information and is intended solely for the individual or entity to which it is addressed.
- Only the intended recipient may review, reproduce, retransmit, disclose, disseminate or otherwise use or take action in reliance upon the information contained in this email and any attachments, with the permission of Australian Arrow Pty. Ltd.
- If you have received this communication in error, please reply to the sender immediately and promptly delete the email and attachments, together with any copies, from all computers.
- It is your responsibility to scan this communication and any attached files for computer viruses and other defects and we recommend that it be subjected to your virus checking procedures prior to use.
- Australian Arrow Pty. Ltd. does not accept liability for any loss or damage of any nature, howsoever caused, which may result directly or indirectly from this communication or any attached files. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pytest-dev/attachments/20060210/6acc6469/attachment.html>


More information about the Pytest-dev mailing list