~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_ui.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-01-23 18:14:16 UTC
  • mfrom: (3948.2.8 progress)
  • Revision ID: pqm@pqm.ubuntu.com-20090123181416-tku4gdtorboy6d0y
(mbp) further progress bar fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2008 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
29
29
    ProgressBarStack,
30
30
    TTYProgressBar,
31
31
    )
 
32
from bzrlib.symbol_versioning import (
 
33
    deprecated_in,
 
34
    )
32
35
from bzrlib.tests import (
33
36
    TestCase,
34
37
    TestUIFactory,
144
147
        ui = TextUIFactory(None, None, None)
145
148
        pb1 = ui.nested_progress_bar()
146
149
        pb2 = ui.nested_progress_bar()
147
 
        # We no longer warn about finishing unnested progress bars.
 
150
        # You do get a warning if the outermost progress bar wasn't finished
 
151
        # first - it's not clear if this is really useful or if it should just
 
152
        # become orphaned -- mbp 20090120
148
153
        warnings, _ = self.callCatchWarnings(pb1.finished)
149
 
        self.assertEqual(len(warnings), 0)
 
154
        if len(warnings) != 1:
 
155
            self.fail("unexpected warnings: %r" % (warnings,))
150
156
        pb2.finished()
151
157
        pb1.finished()
152
158
 
156
162
        stderr = StringIO()
157
163
        stdout = StringIO()
158
164
        # make a stack, which accepts parameters like a pb.
159
 
        stack = ProgressBarStack(to_file=stderr, to_messages_file=stdout)
 
165
        stack = self.applyDeprecated(
 
166
            deprecated_in((1, 12, 0)),
 
167
            ProgressBarStack,
 
168
            to_file=stderr, to_messages_file=stdout)
160
169
        # but is not one
161
170
        self.assertFalse(getattr(stack, 'note', False))
162
171
        pb1 = stack.get_nested()