~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_ui.py

  • Committer: Martin Pool
  • Date: 2008-12-16 06:59:58 UTC
  • mto: (3882.7.11 progress)
  • mto: This revision was merged to the branch mainline in revision 3940.
  • Revision ID: mbp@sourcefrog.net-20081216065958-b4ce9x9w34xwan5a
Progress and UI test cleanups

Show diffs side-by-side

added added

removed removed

Lines of Context:
101
101
    def test_progress_note(self):
102
102
        stderr = StringIO()
103
103
        stdout = StringIO()
104
 
        ui_factory = TextUIFactory(bar_type=TTYProgressBar, stderr=stderr,
 
104
        ui_factory = TextUIFactory(stderr=stderr,
105
105
                stdout=stdout)
106
106
        pb = ui_factory.nested_progress_bar()
107
107
        try:
121
121
        # The PQM redirects the output to a file, so it
122
122
        # defaults to creating a Dots progress bar. we
123
123
        # need to force it to believe we are a TTY
124
 
        ui_factory = TextUIFactory(bar_type=TTYProgressBar,
 
124
        ui_factory = TextUIFactory(
125
125
            stdout=stdout, stderr=stderr)
126
126
        pb = ui_factory.nested_progress_bar()
127
127
        try:
169
169
        pb2.finished()
170
170
        pb1.finished()
171
171
 
172
 
    def test_text_factory_setting_progress_bar(self):
173
 
        # we should be able to choose the progress bar type used.
174
 
        factory = TextUIFactory(bar_type=DotsProgressBar)
175
 
        bar = factory.nested_progress_bar()
176
 
        bar.finished()
177
 
        self.assertIsInstance(bar, DotsProgressBar)
178
 
 
179
172
    def test_cli_stdin_is_default_stdin(self):
180
173
        factory = CLIUIFactory()
181
174
        self.assertEqual(sys.stdin, factory.stdin)
215
208
 
216
209
    def test_text_factory_prompts_and_clears(self):
217
210
        # a get_boolean call should clear the pb before prompting
218
 
        factory = TextUIFactory(bar_type=DotsProgressBar)
 
211
        factory = TextUIFactory()
219
212
        factory.stdout = _TTYStringIO()
220
213
        factory.stdin = StringIO("yada\ny\n")
221
214
        pb = self.apply_redirected(factory.stdin, factory.stdout,