~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_ui.py

  • Committer: Andrew Bennetts
  • Date: 2010-01-13 23:16:20 UTC
  • mfrom: (4957 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4960.
  • Revision ID: andrew.bennetts@canonical.com-20100113231620-n6in2yjib2v6z03g
MergeĀ lp:bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 Canonical Ltd
 
1
# Copyright (C) 2005, 2008, 2009 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
 
127
141
    def test_text_ui_get_boolean(self):
128
142
        stdin = tests.StringIOWrapper("y\n" # True
129
143
                                      "n\n" # False
234
248
        finally:
235
249
            pb.finished()
236
250
 
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
 
 
248
251
 
249
252
class TestTextUIOutputStream(tests.TestCase):
250
253
    """Tests for output stream that synchronizes with progress bar."""