py3: Port pure driver test to Python 3

* Replace func.func_name with func.__name__: the func_name attribute
  was removed in Python 3, whereas the __name__ attribute exists on
  Python 2 and Python 3
* Create INITIATOR_TARGET_MAP using list(set()) to get the same order
  than the tested code. The exact order is not reliable, it depends
  on the hash function which is now randomized by default on
  Python 3. The hash function is also different between Python 2.7
  and 3.4.
* tox.ini: add test_pure to Python 3.4

Blueprint cinder-python3
Change-Id: I78601278259f1d34ad6ac3458d2dd0a3aca9d77a
This commit is contained in:
Victor Stinner 2015-08-27 00:13:51 +02:00
parent f6c1a7399c
commit 3a1c871927
3 changed files with 5 additions and 5 deletions

View File

@ -106,10 +106,9 @@ TARGET_WWN = "21000024ff59fe94"
TARGET_PORT = "3260"
INITIATOR_TARGET_MAP =\
{
'5001500150015081': ['21000024ff59fe93',
'21000024ff59fe92',
'21000024ff59fe91',
'21000024ff59fe94'],
# _build_initiator_target_map() calls list(set()) on the list,
# we must also call list(set()) to get the exact same order
'5001500150015081': list(set(FC_WWNS)),
}
DEVICE_MAPPING =\
{

View File

@ -71,7 +71,7 @@ def log_debug_trace(f):
def wrapper(*args, **kwargs):
cls_name = args[0].__class__.__name__
method_name = "%(cls_name)s.%(method)s" % {"cls_name": cls_name,
"method": f.func_name}
"method": f.__name__}
LOG.debug("Enter " + method_name)
result = f(*args, **kwargs)
LOG.debug("Leave " + method_name)

View File

@ -81,6 +81,7 @@ commands =
cinder.tests.unit.test_netapp_nfs \
cinder.tests.unit.test_nfs \
cinder.tests.unit.test_nimble \
cinder.tests.unit.test_pure \
cinder.tests.unit.test_qos_specs \
cinder.tests.unit.test_quota \
cinder.tests.unit.test_rbd \