~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/progress.py

  • Committer: Robert Collins
  • Date: 2007-11-21 00:16:35 UTC
  • mto: This revision was merged to the branch mainline in revision 3224.
  • Revision ID: robertc@robertcollins.net-20071121001635-xu5ddwu2f8tykf8p
Remove obsolete demo and run tests from bzrlib.progress.

Show diffs side-by-side

added added

removed removed

Lines of Context:
546
546
            self.cur_phase += 1
547
547
        assert self.cur_phase < self.total
548
548
        self.pb.update(self.message, self.cur_phase, self.total)
549
 
 
550
 
 
551
 
def run_tests():
552
 
    import doctest
553
 
    result = doctest.testmod()
554
 
    if result[1] > 0:
555
 
        if result[0] == 0:
556
 
            print "All tests passed"
557
 
    else:
558
 
        print "No tests to run"
559
 
 
560
 
 
561
 
def demo():
562
 
    sleep = time.sleep
563
 
    
564
 
    print 'dumb-terminal test:'
565
 
    pb = DotsProgressBar()
566
 
    for i in range(100):
567
 
        pb.update('Leoparden', i, 99)
568
 
        sleep(0.1)
569
 
    sleep(1.5)
570
 
    pb.clear()
571
 
    sleep(1.5)
572
 
    
573
 
    print 'smart-terminal test:'
574
 
    pb = ProgressBar(show_pct=True, show_bar=True, show_spinner=False)
575
 
    for i in range(100):
576
 
        pb.update('Elephanten', i, 99)
577
 
        sleep(0.1)
578
 
    sleep(2)
579
 
    pb.clear()
580
 
    sleep(1)
581
 
 
582
 
    print 'done!'
583
 
 
584
 
if __name__ == "__main__":
585
 
    demo()