commit 5c31eab09c49cfe7df5b3b397dbaf1447a602ace Author: wu.shiming Date: Tue Oct 13 09:38:56 2020 +0800 Replace assertItemsEqual with assertCountEqual assertItemsEqual was removed from Python's unittest.TestCase in Python 3.3 [1][2]. We have been able to use them since then, because testtools required unittest2, which still included it. With testtools removing Python 2.7 support [3][4], we will lose support for assertItemsEqual, so we should switch to use assertCountEqual. [1] - https://bugs.python.org/issue17866 [2] - https://hg.python.org/cpython/rev/d9921cb6e3cd [3] - testing-cabal/testtools#286 [4] - testing-cabal/testtools#277 Change-Id: I6c165f5600ba281ba41df78de8414404c411d44f diff --git a/openstack/tests/functional/network/v2/test_address_group.py b/openstack/tests/functional/network/v2/test_address_group.py index cb9b8c9..cf3623e 100644 --- a/openstack/tests/functional/network/v2/test_address_group.py +++ b/openstack/tests/functional/network/v2/test_address_group.py @@ -35,7 +35,7 @@ class TestAddressGroup(base.BaseFunctionalTest): self.assertEqual(self.ADDRESS_GROUP_NAME, address_group.name) self.assertEqual(self.ADDRESS_GROUP_DESCRIPTION, address_group.description) - self.assertItemsEqual(self.ADDRESSES, address_group.addresses) + self.assertCountEqual(self.ADDRESSES, address_group.addresses) self.ADDRESS_GROUP_ID = address_group.id def tearDown(self): @@ -70,7 +70,7 @@ class TestAddressGroup(base.BaseFunctionalTest): self.ADDRESS_GROUP_ID, addrs) updated_addrs = self.ADDRESSES.copy() updated_addrs.extend(addrs) - self.assertItemsEqual(updated_addrs, sot.addresses) + self.assertCountEqual(updated_addrs, sot.addresses) sot = self.conn.network.remove_addresses_from_address_group( self.ADDRESS_GROUP_ID, addrs) - self.assertItemsEqual(self.ADDRESSES, sot.addresses) + self.assertCountEqual(self.ADDRESSES, sot.addresses) diff --git a/openstack/tests/unit/network/v2/test_address_group.py b/openstack/tests/unit/network/v2/test_address_group.py index 0fe6a7c..9275575 100644 --- a/openstack/tests/unit/network/v2/test_address_group.py +++ b/openstack/tests/unit/network/v2/test_address_group.py @@ -52,4 +52,4 @@ class TestAddressGroup(base.TestCase): self.assertEqual(EXAMPLE['name'], sot.name) self.assertEqual(EXAMPLE['description'], sot.description) self.assertEqual(EXAMPLE['tenant_id'], sot.project_id) - self.assertItemsEqual(EXAMPLE['addresses'], sot.addresses) + self.assertCountEqual(EXAMPLE['addresses'], sot.addresses)