← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1632856] [NEW] Incorrect datatype for Python 3 in api-samples functional test

 

Public bug reported:

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.

** Affects: nova
     Importance: Undecided
     Assignee: Ed Leafe (ed-leafe)
         Status: New

-- 
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):
  New

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


Follow ups