Handle python 2 and 3 compatibility

* Use six.b('') instead of '' for handling the difference
  between string and bytes in python 2 and 3.
* Use six.BytesIO instead of six.StringIO for processing
  data in bytes.

Depends-On: I3def3147aedbff56e594f4e7addc80054bd3aaa4
Change-Id: Iab8fe32def4590759433404c872a25f050f6a29e
This commit is contained in:
Hongbin Lu 2018-03-10 17:47:27 +00:00
parent 3767dc3698
commit e52e7930d4

View File

@ -144,8 +144,8 @@ class TestContainer(base.BaseZunTest):
# returns generator [1]. These lines
# makes image_data readable.
# [1] https://bugs.launchpad.net/zun/+bug/1753080
image_data = ''.join(image_data)
image_data = six.StringIO(image_data)
image_data = six.b('').join(image_data)
image_data = six.BytesIO(image_data)
image = self.images_client.create_image(
name='cirros', disk_format='raw', container_format='docker')