From: Cyril Roelandt Date: Fri, 24 Jul 2015 14:19:19 +0000 (+0200) Subject: Python 3: fix test_attributes X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=237fa342f9bb459e2c82301a810c8a4a87c38e79;p=openstack-build%2Fneutron-build.git Python 3: fix test_attributes In Python 3, strings have an __iter__ method, which makes convert_to_list fail. Change-Id: I2411ecd31d7d05ff6f0f004180edffc76d28573b Blueprint: neutron-python3 --- diff --git a/neutron/api/v2/attributes.py b/neutron/api/v2/attributes.py index 64a45e891..6beb95b13 100644 --- a/neutron/api/v2/attributes.py +++ b/neutron/api/v2/attributes.py @@ -578,7 +578,7 @@ def convert_none_to_empty_dict(value): def convert_to_list(data): if data is None: return [] - elif hasattr(data, '__iter__'): + elif hasattr(data, '__iter__') and not isinstance(data, six.string_types): return list(data) else: return [data] diff --git a/tox.ini b/tox.ini index 37ddf17cc..39870fb39 100644 --- a/tox.ini +++ b/tox.ini @@ -174,6 +174,7 @@ commands = python -m testtools.run \ neutron.tests.unit.api.rpc.handlers.test_securitygroups_rpc \ neutron.tests.unit.api.rpc.handlers.test_dvr_rpc \ neutron.tests.unit.api.rpc.agentnotifiers.test_dhcp_rpc_agent_api \ + neutron.tests.unit.api.v2.test_attributes \ neutron.tests.unit.agent.metadata.test_driver \ neutron.tests.unit.agent.test_rpc \ neutron.tests.unit.agent.test_securitygroups_rpc \