yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #59774
[Bug 1632856] Re: Incorrect datatype for Python 3 in api-samples functional test
Reviewed: https://review.openstack.org/385686
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=a2d7ebd39b99db9c5728e2a256568b8bbbc4734f
Submitter: Jenkins
Branch: master
commit a2d7ebd39b99db9c5728e2a256568b8bbbc4734f
Author: EdLeafe <ed@xxxxxxxxx>
Date: Wed Oct 12 20:55:40 2016 +0000
Corrects the type of a base64 encoded string
The nova/tests/functional/api_sample_tests/test_servers.py contains the
ServersSampleBase class, and in its class definition creates a
'user_data' attribute by base64 encoding a string. However, this will
not work in Python 3, as the base64.b64encode() method requires bytes,
not a string. As a result, importing the test class fails and no tests
get run.
Note that this change doesn't fix all tests to work under Python 3; it
simply fixes the bug that prevents the tests from running at all under
Python 3.
Closes-Bug: #1632856
Change-Id: I35a7b02132bed0387a173b339f6204bf0e3269de
** Changed in: nova
Status: In Progress => Fix Released
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1632856
Title:
Incorrect datatype for Python 3 in api-samples functional test
Status in OpenStack Compute (nova):
Fix Released
Bug description:
The nova/tests/functional/api_sample_tests/test_servers.py contains
the ServersSampleBase class, and in its class definition creates user
data by base64 encoding a string. However, this will not work in
Python 3, as the base64.b64encode() method requires bytes, not a
string.
This can be seen by simply running 'tox -e functional' under Python 3,
which then emits a series of errors, most of which look like:
Failed to import test module: nova.tests.functional.api_sample_tests.test_servers
Traceback (most recent call last):
File "/home/ed/projects/nova/.tox/functional/lib/python3.4/site-packages/unittest2/loader.py", line 456, in _find_test_path
module = self._get_module_from_name(name)
File "/home/ed/projects/nova/.tox/functional/lib/python3.4/site-packages/unittest2/loader.py", line 395, in _get_module_from_name
__import__(name)
File "/home/ed/projects/nova/nova/tests/functional/api_sample_tests/test_servers.py", line 24, in <module>
class ServersSampleBase(api_sample_base.ApiSampleTestBaseV21):
File "/home/ed/projects/nova/nova/tests/functional/api_sample_tests/test_servers.py", line 29, in ServersSampleBase
user_data = base64.b64encode(user_data_contents)
File "/home/ed/projects/nova/.tox/functional/lib/python3.4/base64.py", line 62, in b64encode
encoded = binascii.b2a_base64(s)[:-1]
TypeError: 'str' does not support the buffer interface
This was reported in https://bugs.launchpad.net/nova/+bug/1632521, and a fix was issued that simply forced tox to use py27.
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1632856/+subscriptions
References