/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: Robert Collins
  • Date: 2010-05-06 11:08:10 UTC
  • mto: This revision was merged to the branch mainline in revision 5223.
  • Revision ID: robertc@robertcollins.net-20100506110810-h3j07fh5gmw54s25
Cleaner matcher matching revised unlocking protocol.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
import re
22
22
import time
23
23
 
 
24
from StringIO import StringIO
 
25
 
24
26
from bzrlib import (
25
27
    errors,
 
28
    remote,
 
29
    repository,
26
30
    tests,
27
31
    ui as _mod_ui,
28
32
    )
245
249
        self.assertIsInstance(ui_factory._progress_view,
246
250
            _mod_ui_text.NullProgressView)
247
251
 
 
252
    def test_text_ui_show_user_warning(self):
 
253
        from bzrlib.repofmt.groupcompress_repo import RepositoryFormat2a
 
254
        from bzrlib.repofmt.pack_repo import RepositoryFormatKnitPack5
 
255
        err = StringIO()
 
256
        out = StringIO()
 
257
        ui = tests.TextUIFactory(stdin=None, stdout=out, stderr=err)
 
258
        remote_fmt = remote.RemoteRepositoryFormat()
 
259
        remote_fmt._network_name = RepositoryFormatKnitPack5().network_name()
 
260
        ui.show_user_warning('cross_format_fetch', from_format=RepositoryFormat2a(),
 
261
            to_format=remote_fmt)
 
262
        self.assertEquals('', out.getvalue())
 
263
        self.assertEquals("Doing on-the-fly conversion from RepositoryFormat2a() to "
 
264
            "RemoteRepositoryFormat(_network_name='Bazaar RepositoryFormatKnitPack5 "
 
265
            "(bzr 1.6)\\n').\nThis may take some time. Upgrade the repositories to "
 
266
            "the same format for better performance.\n",
 
267
            err.getvalue())
 
268
        # and now with it suppressed please
 
269
        err = StringIO()
 
270
        out = StringIO()
 
271
        ui = tests.TextUIFactory(stdin=None, stdout=out, stderr=err)
 
272
        ui.suppressed_warnings.add('cross_format_fetch')
 
273
        ui.show_user_warning('cross_format_fetch', from_format=RepositoryFormat2a(),
 
274
            to_format=remote_fmt)
 
275
        self.assertEquals('', out.getvalue())
 
276
        self.assertEquals('', err.getvalue())
 
277
 
248
278
 
249
279
class TestTextUIOutputStream(tests.TestCase):
250
280
    """Tests for output stream that synchronizes with progress bar."""