Comment 0 for bug 1353788

Revision history for this message
wanghong (w-wanghong) wrote :

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 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!