Switch from unittest2 compat methods to Python 3.x methods
With the removal of Python 2.x we can remove the unittest2 compat wrappers and switch to assertCountEqual instead of assertItemsEqual 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: I4fd20ef857846117b50e8d17fdf98fa4aa117262
This commit is contained in:
parent
33036bcc32
commit
066c1c49b5
|
@ -186,7 +186,7 @@ class ClusterUtilsTestCase(test_base.OsWinBaseTestCase):
|
|||
|
||||
ret = self._clusterutils.get_cluster_node_names()
|
||||
|
||||
self.assertItemsEqual(['node1', 'node2'], ret)
|
||||
self.assertCountEqual(['node1', 'node2'], ret)
|
||||
|
||||
@mock.patch.object(clusterutils.ClusterUtils, '_get_cluster_group_state')
|
||||
def test_get_vm_host(self, mock_get_state):
|
||||
|
@ -208,14 +208,14 @@ class ClusterUtilsTestCase(test_base.OsWinBaseTestCase):
|
|||
mock_get_vm_groups.return_value = [dict(name='vm1'),
|
||||
dict(name='vm2')]
|
||||
ret = self._clusterutils.list_instances()
|
||||
self.assertItemsEqual(['vm1', 'vm2'], ret)
|
||||
self.assertCountEqual(['vm1', 'vm2'], ret)
|
||||
|
||||
@mock.patch.object(clusterutils.ClusterUtils, '_get_vm_groups')
|
||||
def test_list_instance_uuids(self, mock_get_vm_groups):
|
||||
mock_get_vm_groups.return_value = [dict(id='uuid1'),
|
||||
dict(id='uuid2')]
|
||||
ret = self._clusterutils.list_instance_uuids()
|
||||
self.assertItemsEqual(['uuid1', 'uuid2'], ret)
|
||||
self.assertCountEqual(['uuid1', 'uuid2'], ret)
|
||||
|
||||
@ddt.data(True, False)
|
||||
@mock.patch.object(clusterutils.ClusterUtils,
|
||||
|
|
Loading…
Reference in New Issue