/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-08-04 05:20:54 UTC
  • mfrom: (4580.3.11 selftest)
  • Revision ID: pqm@pqm.ubuntu.com-20090804052054-yd271soudff1dbgt
(mbp) fix selftest progress and error display problems

Show diffs side-by-side

added added

removed removed

Lines of Context:
175
175
        self._strict = strict
176
176
 
177
177
    def done(self):
 
178
        # nb: called stopTestRun in the version of this that Python merged
 
179
        # upstream, according to lifeless 20090803
178
180
        if self._strict:
179
181
            ok = self.wasStrictlySuccessful()
180
182
        else:
397
399
                 ):
398
400
        ExtendedTestResult.__init__(self, stream, descriptions, verbosity,
399
401
            bench_history, strict)
400
 
        if pb is None:
401
 
            self.pb = self.ui.nested_progress_bar()
402
 
            self._supplied_pb = False
403
 
        else:
404
 
            self.pb = pb
405
 
            self._supplied_pb = True
 
402
        # We no longer pass them around, but just rely on the UIFactory stack
 
403
        # for state
 
404
        if pb is not None:
 
405
            warnings.warn("Passing pb to TextTestResult is deprecated")
 
406
        self.pb = self.ui.nested_progress_bar()
406
407
        self.pb.show_pct = False
407
408
        self.pb.show_spinner = False
408
409
        self.pb.show_eta = False,
409
410
        self.pb.show_count = False
410
411
        self.pb.show_bar = False
 
412
        self.pb.update_latency = 0
 
413
        self.pb.show_transport_activity = False
 
414
 
 
415
    def done(self):
 
416
        # called when the tests that are going to run have run
 
417
        self.pb.clear()
 
418
        super(TextTestResult, self).done()
 
419
 
 
420
    def finished(self):
 
421
        self.pb.finished()
411
422
 
412
423
    def report_starting(self):
413
424
        self.pb.update('[test 0/%d] Starting' % (self.num_tests))
414
425
 
 
426
    def printErrors(self):
 
427
        # clear the pb to make room for the error listing
 
428
        self.pb.clear()
 
429
        super(TextTestResult, self).printErrors()
 
430
 
415
431
    def _progress_prefix_text(self):
416
432
        # the longer this text, the less space we have to show the test
417
433
        # name...
477
493
    def report_cleaning_up(self):
478
494
        self.pb.update('Cleaning up')
479
495
 
480
 
    def finished(self):
481
 
        if not self._supplied_pb:
482
 
            self.pb.finished()
483
 
 
484
496
 
485
497
class VerboseTestResult(ExtendedTestResult):
486
498
    """Produce long output, with one line per test run plus times"""
724
736
    See also CannedInputUIFactory which lets you provide programmatic input in
725
737
    a structured way.
726
738
    """
 
739
    # TODO: Capture progress events at the model level and allow them to be
 
740
    # observed by tests that care.
 
741
    #
727
742
    # XXX: Should probably unify more with CannedInputUIFactory or a
728
743
    # particular configuration of TextUIFactory, or otherwise have a clearer
729
744
    # idea of how they're supposed to be different.