Py3k compliance: check for bytes when making a string
When faking stdout in tests we must account for the case when "strings" might be bytes, which python3 cares about. Change-Id: I0e9349c86371055eed479799d39ab6adbcad6f95 Closes-Bug: #1499004
This commit is contained in:
parent
3e115991c1
commit
fcf289797c
|
@ -73,6 +73,12 @@ class FakeStdout(object):
|
|||
def make_string(self):
|
||||
result = ''
|
||||
for line in self.content:
|
||||
if six.PY3:
|
||||
if isinstance(line, bytes):
|
||||
try:
|
||||
line = line.decode(encoding='utf-8')
|
||||
except UnicodeError:
|
||||
pass
|
||||
result = result + line
|
||||
return result
|
||||
|
||||
|
|
Loading…
Reference in New Issue