nova report DeprecationWarning message when using exception.message

Bug #1447946 reported by Eli Qiao
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Eli Qiao

Bug Description

taget@taget-ThinkStation-P300:~/nova$ tox -e py27 nova.tests.unit.compute.test_flavors.CreateFlavorTestCase.test_create_flavor_ram_error
py27 develop-inst-nodeps: /home/taget/nova
py27 runtests: PYTHONHASHSEED='0'
py27 runtests: commands[0] | find . -type f -name *.pyc -delete
py27 runtests: commands[1] | bash tools/pretty_tox.sh nova.tests.unit.compute.test_flavors.CreateFlavorTestCase.test_create_flavor_ram_error
running testr
running=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-160} \
${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./nova/tests} --list
running=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-160} \
${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./nova/tests} --load-list /tmp/tmpBqJXFX
{0} nova.tests.unit.compute.test_flavors.CreateFlavorTestCase.test_create_flavor_ram_error [0.086535s] ... ok

Captured stderr:
~~~~~~~~~~~~~~~~
    nova/tests/unit/compute/test_flavors.py:45: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
      self.assertIn("ram", e.message)

and this can be fixed by overwrite NovaException.message see [1]
[1] http://stackoverflow.com/questions/1319615/proper-way-to-declare-custom-exceptions-in-modern-python/26938914#26938914

Eli Qiao (taget-9)
Changed in nova:
assignee: nobody → Eli Qiao (taget-9)
status: New → Confirmed
summary: - nova report DeprecationWarning message is using exception.message
+ nova report DeprecationWarning message when using exception.message
Changed in nova:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/177105
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=731719d4a05c12adb75cf075f769ef26e7b81ef2
Submitter: Jenkins
Branch: master

commit 731719d4a05c12adb75cf075f769ef26e7b81ef2
Author: Eli Qiao <email address hidden>
Date: Fri Apr 24 15:47:33 2015 +0800

    Overwrite NovaException message

    I see nova reports DeprecationWarning message when using exception.message.

    DeprecationWarning: BaseException.message has been deprecated as of Python 2.6

    This can be fixed by overwrite message in our Nova base Exception.

    Closes-Bug: #1447946
    Change-Id: I7270e06622131af1565f748f69aa3497ca7ef4d2

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → liberty-1
status: Fix Committed → Fix Released
Matt Riedemann (mriedem)
Changed in nova:
importance: Undecided → Low
Thierry Carrez (ttx)
Changed in nova:
milestone: liberty-1 → 12.0.0
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.