/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: Jelmer Vernooij
  • Date: 2010-03-21 21:39:33 UTC
  • mfrom: (5102 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5143.
  • Revision ID: jelmer@samba.org-20100321213933-fexeh9zcoz8oaju2
merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2008, 2009 Canonical Ltd
 
1
# Copyright (C) 2005-2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
124
124
        finally:
125
125
            pb.finished()
126
126
 
127
 
    def test_progress_nested(self):
128
 
        # test factory based nested and popping.
129
 
        ui = _mod_ui_text.TextUIFactory(None, None, None)
130
 
        pb1 = ui.nested_progress_bar()
131
 
        pb2 = ui.nested_progress_bar()
132
 
        # You do get a warning if the outermost progress bar wasn't finished
133
 
        # first - it's not clear if this is really useful or if it should just
134
 
        # become orphaned -- mbp 20090120
135
 
        warnings, _ = self.callCatchWarnings(pb1.finished)
136
 
        if len(warnings) != 1:
137
 
            self.fail("unexpected warnings: %r" % (warnings,))
138
 
        pb2.finished()
139
 
        pb1.finished()
140
 
 
141
127
    def test_text_ui_get_boolean(self):
142
128
        stdin = tests.StringIOWrapper("y\n" # True
143
129
                                      "n\n" # False
248
234
        finally:
249
235
            pb.finished()
250
236
 
 
237
    def test_quietness(self):
 
238
        os.environ['BZR_PROGRESS_BAR'] = 'text'
 
239
        ui_factory = _mod_ui_text.TextUIFactory(None,
 
240
            test_progress._TTYStringIO(),
 
241
            test_progress._TTYStringIO())
 
242
        self.assertIsInstance(ui_factory._progress_view,
 
243
            _mod_ui_text.TextProgressView)
 
244
        ui_factory.be_quiet(True)
 
245
        self.assertIsInstance(ui_factory._progress_view,
 
246
            _mod_ui_text.NullProgressView)
 
247
 
251
248
 
252
249
class TestTextUIOutputStream(tests.TestCase):
253
250
    """Tests for output stream that synchronizes with progress bar."""