/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/ui_testing.py

  • Committer: Jelmer Vernooij
  • Date: 2020-05-06 02:13:25 UTC
  • mfrom: (7490.7.21 work)
  • mto: This revision was merged to the branch mainline in revision 7501.
  • Revision ID: jelmer@jelmer.uk-20200506021325-awbmmqu1zyorz7sj
Merge 3.1 branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
from __future__ import absolute_import
18
 
 
19
17
import io
20
18
 
21
19
from .. import (
22
20
    ui,
23
21
)
24
22
from ..ui import text as ui_text
25
 
from ..sixish import (
26
 
    text_type,
27
 
)
28
23
 
29
24
 
30
25
class StringIOWithEncoding(io.StringIO):
54
49
    def __init__(self, stdin=None, stdout=None, stderr=None):
55
50
        if isinstance(stdin, bytes):
56
51
            stdin = stdin.decode()
57
 
        if isinstance(stdin, text_type):
 
52
        if isinstance(stdin, str):
58
53
            stdin = StringIOWithEncoding(stdin)
59
54
        if stdout is None:
60
55
            stdout = StringIOWithEncoding()
62
57
            stderr = StringIOWithEncoding()
63
58
        super(TextUIFactory, self).__init__(stdin, stdout, stderr)
64
59
 
 
60
    def _setup_streams(self):
 
61
        self.raw_stdin = self.stdin
 
62
        self.raw_stdout = self.stdout
 
63
        self.raw_stderr = self.stderr
 
64
 
65
65
 
66
66
class TestUIFactory(TextUIFactory):
67
67
    """A UI Factory for testing.