Remove 'b' from sys.stdout.mode
This commit is contained in:
parent
6a43c8cd94
commit
4318698bae
|
@ -0,0 +1 @@
|
|||
Ensure that ``sys.stdout.mode`` does not include ``'b'`` as it is a text stream.
|
|
@ -447,6 +447,10 @@ class EncodedFile(object):
|
|||
"""Ensure that file.name is a string."""
|
||||
return repr(self.buffer)
|
||||
|
||||
@property
|
||||
def mode(self):
|
||||
return self.buffer.mode.replace("b", "")
|
||||
|
||||
def __getattr__(self, name):
|
||||
return getattr(object.__getattribute__(self, "buffer"), name)
|
||||
|
||||
|
|
|
@ -1051,6 +1051,9 @@ class TestFDCapture(object):
|
|||
cap.done()
|
||||
pytest.raises(AttributeError, cap.suspend)
|
||||
|
||||
def test_capfd_sys_stdout_mode(self, capfd):
|
||||
assert "b" not in sys.stdout.mode
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def saved_fd(fd):
|
||||
|
|
Loading…
Reference in New Issue