This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author chris.jerdonek
Recipients chris.jerdonek, michael.foord, mikehoy, r.david.murray, rbcollins
Date 2012-10-20.15:09:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1350745768.44.0.170557583196.issue16288@psf.upfronthosting.co.za>
In-reply-to
Content
> So the relevant code is this:
> def getDescription(self, test):
> ...
> 43 return str(test)
> ...
> What I'd like is to have this be something like:
> 44     return test.id()

> Or anther way this could be done would be to make TestCase.__str__ call self.id()

Note that str(test) and test.id() don't return the same value.  The former is the "friendly" name.  It is probably intentional that TextTestResult uses the TestCase instance's friendly name in its getDescription() method as opposed to the id.

> TextTestRunner calls str(TestCase) directly, which makes it hard for testscenarios to rename the test cases as it parameterises them

What about testscenarios subclassing the TestCase instances as it parametrizes them?

    class ScenariosTestCase(case.__class__):
        def __str__(self):
            return "testscenarios test name..."
    case.__class__ = ScenariosTestCase
    print(str(case))

From the documentation, it looks like testscenarios creates new test objects from the originals anyways.  Alternatively (although I don't if testscenarios can control what test runner is being used), TextTestRunner could be subclassed with its own getDescription() method.
History
Date User Action Args
2012-10-20 15:09:28chris.jerdoneksetrecipients: + chris.jerdonek, rbcollins, r.david.murray, michael.foord, mikehoy
2012-10-20 15:09:28chris.jerdoneksetmessageid: <1350745768.44.0.170557583196.issue16288@psf.upfronthosting.co.za>
2012-10-20 15:09:28chris.jerdoneklinkissue16288 messages
2012-10-20 15:09:28chris.jerdonekcreate