~ubuntu-branches/ubuntu/karmic/bzr/karmic-proposed

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_ui.py

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij
  • Date: 2009-03-10 14:11:59 UTC
  • mfrom: (1.1.49 upstream) (3.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090310141159-0q0938373dnw9qw2
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
from StringIO import StringIO
22
22
import re
23
23
import sys
 
24
import time
24
25
 
25
26
import bzrlib
26
27
import bzrlib.errors as errors
157
158
        pb1.finished()
158
159
 
159
160
    def test_progress_stack(self):
160
 
        # test the progress bar stack which the default text factory 
 
161
        # test the progress bar stack which the default text factory
161
162
        # uses.
162
163
        stderr = StringIO()
163
164
        stdout = StringIO()
237
238
            r"what do you want\? \[y/n\]: what do you want\? \[y/n\]: ")
238
239
        # stdin should have been totally consumed
239
240
        self.assertEqual('', factory.stdin.readline())
 
241
 
 
242
    def test_text_tick_after_update(self):
 
243
        ui_factory = TextUIFactory(stdout=StringIO(), stderr=StringIO())
 
244
        pb = ui_factory.nested_progress_bar()
 
245
        try:
 
246
            pb.update('task', 0, 3)
 
247
            # Reset the clock, so that it actually tries to repaint itself
 
248
            ui_factory._progress_view._last_repaint = time.time() - 1.0
 
249
            pb.tick()
 
250
        finally:
 
251
            pb.finished()