Mercurial > py-sdl2
changeset 151:5a9af21a54c8 tests-logfile
test/util/support: Encode data in TeeOutput for binary streams of Python 3
| author | anatoly techtonik <techtonik@gmail.com> |
|---|---|
| date | Sun, 02 Feb 2014 12:38:16 +0300 |
| parents | 080b25a36aa5 |
| children | 91a1aa5b2260 |
| files | sdl2/test/util/support.py |
| diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/sdl2/test/util/support.py Thu Jan 23 07:48:03 2014 +0100 +++ b/sdl2/test/util/support.py Sun Feb 02 12:38:16 2014 +0300 @@ -3,6 +3,9 @@ # # """Utility functions for the tests.""" import os +import sys + +PY3K = sys.version_info[0] == 3 class StreamOutput(object): def __init__(self, stream): @@ -44,6 +47,9 @@ # -- methods from sys.stdout / sys.stderr def write(self, data): for stream in self.outputs: + if PY3K: + if 'b' in stream.mode: + data = data.encode('utf-8') stream.write(data) def tell(self):
