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 gregory.p.smith
Recipients gregory.p.smith, michael.foord
Date 2013-08-16.23:45:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1376696752.64.0.473845221037.issue18765@psf.upfronthosting.co.za>
In-reply-to
Content
A few times now I've seen people write something that overrides and re-implements the unittest.TestCase run() method, copying most of the implementation but adding one feature:

The ability for pdb.post_mortem() to be called after every phase of execution iff an exception/error was caught (setUp(), the testMethod() call itself and tearDown()).

I really hate seeing people have to copy the run method implementation and modify it.

We could support this either by adding another debugHook() method to the TestCase API.  Proposal: it gets called within the except: clause surrounding each phase of test execution.

Turning on support for automatic pdb.post_mortem(), typically controlled via a flag or other environment configurable as it isn't desirable during automation:

  def debugHook(self):
    if SOMETHING_SAYS_TO_ENABLE_THIS:
      pdb.post_mortem()

no more copy and pasting the run() method.
History
Date User Action Args
2013-08-16 23:45:52gregory.p.smithsetrecipients: + gregory.p.smith, michael.foord
2013-08-16 23:45:52gregory.p.smithsetmessageid: <1376696752.64.0.473845221037.issue18765@psf.upfronthosting.co.za>
2013-08-16 23:45:52gregory.p.smithlinkissue18765 messages
2013-08-16 23:45:52gregory.p.smithcreate