Python 3: AttributeError in find_resource

Bug #1265879 reported by Cyril Roelandt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-keystoneclient
Fix Released
Medium
Cyril Roelandt

Bug Description

When running tests from keystoneclient/tests/test_utils.py with Python 3, the following error occurs:

======================================================================
ERROR: keystoneclient.tests.test_utils.FindResourceTestCase.test_find_by_str_name
----------------------------------------------------------------------
testtools.testresult.real._StringException: Traceback (most recent call last):
  File "/home/cyril/openstack/python-keystoneclient/keystoneclient/tests/test_utils.py", line 87, in test_find_by_str_name
    output = utils.find_resource(self.manager, 'entity_one')
  File "/home/cyril/openstack/python-keystoneclient/keystoneclient/utils.py", line 105, in find_resource
    name_or_id = name_or_id.decode('utf-8', 'strict')
AttributeError: 'str' object has no attribute 'decode'

name_or_id is probably a text string in Python, and therefore it cannot be decoded.

Changed in python-keystoneclient:
assignee: nobody → Cyril Roelandt (cyril-roelandt)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-keystoneclient (master)

Reviewed: https://review.openstack.org/62386
Committed: https://git.openstack.org/cgit/openstack/python-keystoneclient/commit/?id=f9e3b7adc980ae6722dfa59f8785ccaa4dc45c04
Submitter: Jenkins
Branch: master

commit f9e3b7adc980ae6722dfa59f8785ccaa4dc45c04
Author: Cyril Roelandt <email address hidden>
Date: Mon Dec 16 15:52:24 2013 +0100

    Do not try to call decode() on a text string

    This fixes a call to 'isinstance' that only worked on Python2.

    Closes-Bug: #1265879
    Change-Id: I886da95f1ad2a8314de92be8aecb354ee3124e6d

Changed in python-keystoneclient:
status: In Progress → Fix Committed
Dolph Mathews (dolph)
Changed in python-keystoneclient:
importance: Undecided → Medium
Dolph Mathews (dolph)
Changed in python-keystoneclient:
milestone: none → 0.4.2
Dolph Mathews (dolph)
Changed in python-keystoneclient:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.