~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_osutils_encodings.py

Merge hpss-no-vfs branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Tests for the osutils wrapper."""
18
18
 
19
19
import codecs
 
20
import errno
20
21
import locale
 
22
import os
21
23
import sys
22
24
 
23
25
from bzrlib import (
221
223
                          '  doesn\'t support the locale set by $LANG (BOGUS)\n'
222
224
                          '  Continuing with ascii encoding.\n',
223
225
                          sys.stderr.getvalue())
 
226
 
 
227
 
 
228
class TestMessageEncoding(TestCase):
 
229
    """Tests for getting the encoding used by system messages"""
 
230
 
 
231
    def test_get_message_encoding(self):
 
232
        encoding_name = osutils.get_message_encoding()
 
233
        "".decode(encoding_name) # should be a valid encoding name
 
234
 
 
235
    def test_get_message_encoding_decodes_strerror(self):
 
236
        encoding_name = osutils.get_message_encoding()
 
237
        for number, name in errno.errorcode.iteritems():
 
238
            string = os.strerror(number)
 
239
            string.decode(encoding_name)