diff options
author | Riccardo Pittau <elfosardo@gmail.com> | 2020-07-07 16:31:44 +0200 |
---|---|---|
committer | Riccardo Pittau <elfosardo@gmail.com> | 2020-07-07 16:33:41 +0200 |
commit | c85a33d650066827836257461da764c08a964226 (patch) | |
tree | 8807c8fbdf3c5370260be9f431a8cc22e8f4d327 | |
parent | 3c47122f363756911f066f8cf8ecb0b1cac1335b (diff) | |
download | ironic-c85a33d650066827836257461da764c08a964226.tar.gz |
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
-rw-r--r-- | ironic/tests/unit/drivers/modules/network/test_common.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ironic/tests/unit/drivers/modules/network/test_common.py b/ironic/tests/unit/drivers/modules/network/test_common.py index 722db4685..eefbd8a9d 100644 --- a/ironic/tests/unit/drivers/modules/network/test_common.py +++ b/ironic/tests/unit/drivers/modules/network/test_common.py @@ -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]) |