it will fail if test test_find_resource singly

Bug #1353788 reported by wanghong
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-openstackclient
Fix Released
Undecided
wanghong

Bug Description

tox -e py27 openstackclient.tests.volume.test_find_resource

======================================================================
FAIL: openstackclient.tests.volume.test_find_resource.TestFindResourceVolumeSnapshots.test_find
tags: worker-3
----------------------------------------------------------------------
Empty attachments:
  stderr
  stdout

Traceback (most recent call last):
  File "openstackclient/tests/volume/test_find_resource.py", line 65, in test_find
    result = utils.find_resource(self.manager, NAME)
  File "openstackclient/common/utils.py", line 62, in find_resource
    raise exceptions.CommandError(msg)
CommandError: No snapshot with a name or ID of 'PhilSpector' exists.
======================================================================
FAIL: openstackclient.tests.volume.test_find_resource.TestFindResourceVolumes.test_find
tags: worker-3
----------------------------------------------------------------------
Empty attachments:
  stderr
  stdout

Traceback (most recent call last):
  File "openstackclient/tests/volume/test_find_resource.py", line 43, in test_find
    result = utils.find_resource(self.manager, NAME)
  File "openstackclient/common/utils.py", line 62, in find_resource
    raise exceptions.CommandError(msg)
CommandError: No volume with a name or ID of 'PhilSpector' exists.
======================================================================

Currently, we set 'NAME_ATTR' attribute for Volume and Snapshot class in https://github.com/openstack/python-openstackclient/blob/master/openstackclient/volume/client.py#L26. So, when we test test_find_resource singly the Volume and Snapshot class do not have 'NAME_ATTR' attribute since we will not import volume.client. Then the test fails.

If I add 'from openstackclient.volume import client' in test_find_resource.py, it works well!

wanghong (w-wanghong)
Changed in python-openstackclient:
assignee: nobody → wanghong (w-wanghong)
wanghong (w-wanghong)
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-openstackclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/112458

Changed in python-openstackclient:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-openstackclient (master)

Reviewed: https://review.openstack.org/112458
Committed: https://git.openstack.org/cgit/openstack/python-openstackclient/commit/?id=ddb7e18974964abbe3fc50dab47ab55286a7328c
Submitter: Jenkins
Branch: master

commit ddb7e18974964abbe3fc50dab47ab55286a7328c
Author: wanghong <email address hidden>
Date: Thu Aug 7 11:14:00 2014 +0800

    test_find_resource fails if run alone

    Currently, we set 'NAME_ATTR' attribute for Volume and Snapshot
    class in volume.client.py. When we test test_find_resource alone,
    the Volume and Snapshot class do not have 'NAME_ATTR' attribute since
    we do not import volume.client, which causes the tests to fail.

    Change-Id: I06f727ffa8d37afe1a1191c36574887fecc7a733
    Closes-Bug: #1353788

Changed in python-openstackclient:
status: In Progress → Fix Committed
Dean Troyer (dtroyer)
Changed in python-openstackclient:
milestone: none → m5
Dean Troyer (dtroyer)
Changed in python-openstackclient:
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.