Use Python 3 style qualified exception names in tracebacks

Bug #663600 reported by Martin Packman
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
testtools
Fix Released
Medium
Robert Collins

Bug Description

Originally as part of my unicode traceback work I had the module name included when printing exceptions, as Python 3 does. However it broke a few tests, and wasn't really a requirement to get non-ascii tracebacks working so I removed that logic. Putting it back in would be particularly useful for things called 'error', is that socket.error or pywintypes.error or...?

Revision history for this message
Jonathan Lange (jml) wrote :

Can you give an example of socket.error being displayed without the "socket." bit?

Changed in testtools:
status: New → Triaged
importance: Undecided → Low
Revision history for this message
Martin Packman (gz) wrote :

Python 2.7.0+ (trunk, Oct 25 2010, 18:06:24) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket, traceback
>>> traceback.format_exception_only(socket.error, socket.error("fish"))
['error: fish\n']

Python 3.2a3+ (py3k, Oct 25 2010, 17:22:39) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket, traceback
>>> traceback.format_exception_only(socket.error, socket.error("fish"))
['socket.error: fish\n']

The testtools code does basically the same thing the Python 2 code does.

Revision history for this message
Robert Collins (lifeless) wrote :

I'd love to see this fixed with a helper - Raises and MatchesException want the same facility.

Changed in testtools:
importance: Low → Medium
Revision history for this message
Robert Collins (lifeless) wrote :

Fixed by using traceback2.

Changed in testtools:
assignee: nobody → Robert Collins (lifeless)
milestone: none → next
status: Triaged → Fix Committed
Changed in testtools:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.