Chris Jerdonek added the comment:

An idea occurred to me on this recently. Instead of changing TextTestResult to 
call test.id() everywhere instead of str(test), what about making 
TextTestResult DRY by having it call a new method called something like 
self.getName(test)?

With this approach, customizing the test name would simply be a matter of 
subclassing TextTestResult and overriding TextTestResult.getName() (which 
unittest makes easy). This is much easier than trying to modify the test cases 
themselves (which unittest doesn't make easy). It's also more natural as the 
responsibility for formatting should lie with the test result classes rather 
than with the test case classes themselves (e.g. as discussed in #22431).

----------

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

Reply via email to