/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 breezy/tests/test_osutils_encodings.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-22 00:56:52 UTC
  • mfrom: (6621.2.26 py3_pokes)
  • Revision ID: jelmer@jelmer.uk-20170522005652-yjahcr9hwmjkno7n
Merge Python3 porting work ('py3 pokes')

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
import locale
21
21
import sys
22
22
 
23
 
from breezy import (
 
23
from .. import (
24
24
    osutils,
25
25
    )
26
 
from breezy.tests import (
27
 
        StringIOWrapper,
28
 
        TestCase,
29
 
        )
 
26
from . import (
 
27
    TestCase,
 
28
    )
 
29
from .ui_testing import BytesIOWithEncoding
30
30
 
31
31
 
32
32
class FakeCodec(object):
84
84
                             stdin_encoding,
85
85
                             user_encoding='user_encoding',
86
86
                             enable_fake_encodings=True):
87
 
        sys.stdout = StringIOWrapper()
 
87
        sys.stdout = BytesIOWithEncoding()
88
88
        sys.stdout.encoding = stdout_encoding
89
 
        sys.stderr = StringIOWrapper()
 
89
        sys.stderr = BytesIOWithEncoding()
90
90
        sys.stderr.encoding = stderr_encoding
91
 
        sys.stdin = StringIOWrapper()
 
91
        sys.stdin = BytesIOWithEncoding()
92
92
        sys.stdin.encoding = stdin_encoding
93
93
        osutils._cached_user_encoding = user_encoding
94
94
        if enable_fake_encodings:
171
171
        self.overrideAttr(osutils, '_cached_user_encoding', None)
172
172
        self.overrideAttr(locale, 'getpreferredencoding', self.get_encoding)
173
173
        self.overrideAttr(locale, 'CODESET', None)
174
 
        self.overrideAttr(sys, 'stderr', StringIOWrapper())
 
174
        self.overrideAttr(sys, 'stderr', BytesIOWithEncoding())
175
175
 
176
176
    def get_encoding(self, do_setlocale=True):
177
177
        return self._encoding