~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-09-16 02:52:14 UTC
  • mfrom: (4685.1.2 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20090916025214-6cyz9179xs7f1w70
(robertc) Support dropping into pdb on failing tests. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
298
298
        elif isinstance(err[1], UnavailableFeature):
299
299
            return self.addNotSupported(test, err[1].args[0])
300
300
        else:
 
301
            self._post_mortem()
301
302
            unittest.TestResult.addError(self, test, err)
302
303
            self.error_count += 1
303
304
            self.report_error(test, err)
315
316
        if isinstance(err[1], KnownFailure):
316
317
            return self._addKnownFailure(test, err)
317
318
        else:
 
319
            self._post_mortem()
318
320
            unittest.TestResult.addFailure(self, test, err)
319
321
            self.failure_count += 1
320
322
            self.report_failure(test, err)
404
406
            self.stream.writeln(self.separator2)
405
407
            self.stream.writeln("%s" % err)
406
408
 
 
409
    def _post_mortem(self):
 
410
        """Start a PDB post mortem session."""
 
411
        if os.environ.get('BZR_TEST_PDB', None):
 
412
            import pdb;pdb.post_mortem()
 
413
 
407
414
    def progress(self, offset, whence):
408
415
        """The test is adjusting the count of tests to run."""
409
416
        if whence == SUBUNIT_SEEK_SET: