Use assertCountEqual instead of assertItemsEqual, part 2

Follow up of https://review.opendev.org/735127

The assertItemsEqual method has been removed in Python 3.3 [1] but
it was kept alive by unittest2, imported by testtools.
To prevent mayhem and despair caused by testtools removing unittest2
from its requirements in the near future, we switch to assertCountEqual.

For an unknown reason, some asserts were forgotten, this patch fixes
them all, for real, I swear.

[1] https://bugs.python.org/issue17866

Change-Id: I51a31204ddef83fe36a55631f1a81bff346d176b
This commit is contained in:
Riccardo Pittau 2020-07-07 16:31:44 +02:00
parent 3c47122f36
commit c85a33d650
1 changed files with 4 additions and 4 deletions

View File

@ -218,7 +218,7 @@ class TestCommonFunctions(db_base.DbTestCase):
free_port_like_objs = (
common._get_free_portgroups_and_ports(
task, self.vif_id, {}, {'port_uuid': self.port.uuid}))
self.assertItemsEqual(
self.assertCountEqual(
[self.port.uuid],
[p.uuid for p in free_port_like_objs])
@ -231,7 +231,7 @@ class TestCommonFunctions(db_base.DbTestCase):
free_port_like_objs = (
common._get_free_portgroups_and_ports(
task, self.vif_id, {}, {'portgroup_uuid': pg1.uuid}))
self.assertItemsEqual(
self.assertCountEqual(
[pg1.uuid],
[p.uuid for p in free_port_like_objs])
@ -244,7 +244,7 @@ class TestCommonFunctions(db_base.DbTestCase):
free_port_like_objs = (
common._get_free_portgroups_and_ports(
task, self.vif_id, {}, {'portgroup_uuid': pg2.uuid}))
self.assertItemsEqual(
self.assertCountEqual(
[],
[p.uuid for p in free_port_like_objs])
@ -258,7 +258,7 @@ class TestCommonFunctions(db_base.DbTestCase):
common._get_free_portgroups_and_ports(
task, self.vif_id, {},
{'port_uuid': uuidutils.generate_uuid()}))
self.assertItemsEqual(
self.assertCountEqual(
[],
[p.uuid for p in free_port_like_objs])