~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_ui.py

  • Committer: Martin Pool
  • Date: 2006-03-06 11:20:10 UTC
  • mfrom: (1593 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1611.
  • Revision ID: mbp@sourcefrog.net-20060306112010-17c0170dde5d1eea
[merge] large merge to sync with bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
"""
19
19
 
20
20
import os
 
21
from StringIO import StringIO
21
22
import sys
22
23
 
 
24
from bzrlib.progress import TTYProgressBar
23
25
from bzrlib.tests import TestCase
24
26
from bzrlib.ui import SilentUIFactory
25
27
from bzrlib.ui.text import TextUIFactory
50
52
        #                                   user=u'some\u1234')
51
53
        #                  , 'bogus')
52
54
 
 
55
 
 
56
    def test_progress_note(self):
 
57
        stderr = StringIO()
 
58
        stdout = StringIO()
 
59
        ui = TextUIFactory()
 
60
        pb = TTYProgressBar(to_file=stderr, to_messages_file=stdout)
 
61
        result = pb.note('t')
 
62
        self.assertEqual(None, result)
 
63
        self.assertEqual("t\n", stdout.getvalue())
 
64
        # the exact contents will depend on the terminal width and we don't
 
65
        # care about that right now - but you're probably running it on at
 
66
        # least a 10-character wide terminal :)
 
67
        self.assertContainsRe(stderr.getvalue(), r'^\r {10,}\r$')