Author chris.jerdonek
Recipients chris.jerdonek, eric.araujo, michael.foord, r.david.murray, rbcollins
Date 2016-09-13.11:52:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1473767534.38.0.454086301842.issue16288@psf.upfronthosting.co.za>
In-reply-to
Content
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).
History
Date User Action Args
2016-09-13 11:52:14chris.jerdoneksetrecipients: + chris.jerdonek, rbcollins, eric.araujo, r.david.murray, michael.foord
2016-09-13 11:52:14chris.jerdoneksetmessageid: <1473767534.38.0.454086301842.issue16288@psf.upfronthosting.co.za>
2016-09-13 11:52:14chris.jerdoneklinkissue16288 messages
2016-09-13 11:52:14chris.jerdonekcreate