diff options
author | Henry Gessau <gessau@cisco.com> | 2015-09-23 13:31:50 -0400 |
---|---|---|
committer | Ihar Hrachyshka <ihrachys@redhat.com> | 2015-09-24 08:59:52 +0000 |
commit | db7eb557403da7c0e1eca7e12f6ddab6bc0d1fc1 (patch) | |
tree | 2e3592f2e6b213262f32efc3cda51a74a40d0d94 | |
parent | 3e115991c1cf9ec7cf4252440fa8d6015a5f53ce (diff) | |
download | python-neutronclient-db7eb557403da7c0e1eca7e12f6ddab6bc0d1fc1.tar.gz |
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
(cherry picked from commit fcf289797c063088f9003359dfd1c7d4f41ed5ef)
-rw-r--r-- | neutronclient/tests/unit/test_cli20.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/neutronclient/tests/unit/test_cli20.py b/neutronclient/tests/unit/test_cli20.py index 94d979c..240d8c9 100644 --- a/neutronclient/tests/unit/test_cli20.py +++ b/neutronclient/tests/unit/test_cli20.py @@ -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 |