/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/test_ui.py

  • Committer: John Arbash Meinel
  • Date: 2006-07-12 02:45:22 UTC
  • mto: This revision was merged to the branch mainline in revision 1854.
  • Revision ID: john@arbash-meinel.com-20060712024522-635f6de9df561c84
ui tests were failing when output was redirected to a file. (thus blocked by the pqm)

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
import bzrlib.errors as errors
27
27
from bzrlib.progress import TTYProgressBar, ProgressBarStack
28
28
from bzrlib.tests import TestCase
 
29
from bzrlib.tests.test_progress import _TTYStringIO
29
30
from bzrlib.ui import SilentUIFactory
30
31
from bzrlib.ui.text import TextUIFactory
31
32
 
63
64
    def test_progress_note(self):
64
65
        stderr = StringIO()
65
66
        stdout = StringIO()
66
 
        ui_factory = TextUIFactory()
 
67
        ui_factory = TextUIFactory(bar_type=TTYProgressBar)
67
68
        pb = ui_factory.nested_progress_bar()
68
69
        try:
69
70
            pb.to_messages_file = stdout
80
81
    def test_progress_note_clears(self):
81
82
        stderr = StringIO()
82
83
        stdout = StringIO()
83
 
        ui_factory = TextUIFactory()
 
84
        # The PQM redirects the output to a file, so it
 
85
        # defaults to creating a Dots progress bar. we
 
86
        # need to force it to believe we are a TTY
 
87
        ui_factory = TextUIFactory(bar_type=TTYProgressBar)
84
88
        pb = ui_factory.nested_progress_bar()
85
89
        try:
86
90
            pb.to_messages_file = stdout
173
177
    def test_text_factory_prompts_and_clears(self):
174
178
        # a get_boolean call should clear the pb before prompting
175
179
        factory = bzrlib.ui.text.TextUIFactory()
176
 
        factory.stdout = StringIO()
 
180
        factory.stdout = _TTYStringIO()
177
181
        factory.stdin = StringIO("yada\ny\n")
178
182
        pb = self.apply_redirected(
179
183
            factory.stdin, factory.stdout, factory.stdout, factory.nested_progress_bar)
194
198
            "\r   *" 
195
199
            "\rwhat do you want\\? \\[y/n\\]:what do you want\\? \\[y/n\\]:", 
196
200
            output):
197
 
            self.fail("didn't match factory output %r" % factory)
 
201
            self.fail("didn't match factory output %r, %s" % (factory, output))