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: I7767abc2ed4317288303fc9a2235e869f46a63b0
This commit is contained in:
parent
9b87c6f79d
commit
188cbed313
|
@ -144,7 +144,7 @@ class DISCOConnectorTestCase(test_connector.ConnectorTestCase):
|
|||
"""Test to get all the available DISCO volumes."""
|
||||
expected = ['/dev/dms1234567']
|
||||
actual = self.connector.get_all_available_volumes(None)
|
||||
self.assertItemsEqual(expected, actual)
|
||||
self.assertCountEqual(expected, actual)
|
||||
|
||||
def test_extend_volume(self):
|
||||
self.assertRaises(NotImplementedError,
|
||||
|
|
|
@ -424,7 +424,7 @@ class FibreChannelConnectorTestCase(test_connector.ConnectorTestCase):
|
|||
mock_isdir.return_value = False
|
||||
expected = []
|
||||
actual = self.connector.get_all_available_volumes()
|
||||
self.assertItemsEqual(expected, actual)
|
||||
self.assertCountEqual(expected, actual)
|
||||
|
||||
@mock.patch('eventlet.greenthread.sleep', mock.Mock())
|
||||
@mock.patch.object(linuxscsi.LinuxSCSI, 'find_multipath_device')
|
||||
|
|
|
@ -919,7 +919,7 @@ Setting up iSCSI targets: unused
|
|||
mock_isdir.return_value = False
|
||||
expected = []
|
||||
actual = self.connector.get_all_available_volumes()
|
||||
self.assertItemsEqual(expected, actual)
|
||||
self.assertCountEqual(expected, actual)
|
||||
|
||||
@mock.patch.object(iscsi.ISCSIConnector, '_get_device_path')
|
||||
def test_get_potential_paths_mpath(self, get_path_mock):
|
||||
|
|
|
@ -60,7 +60,7 @@ class WindowsFCConnectorTestCase(test_base.WindowsConnectorTestBase):
|
|||
else:
|
||||
expected_props = {}
|
||||
|
||||
self.assertItemsEqual(expected_props, props)
|
||||
self.assertCountEqual(expected_props, props)
|
||||
|
||||
@mock.patch.object(fc.WindowsFCConnector, '_get_scsi_wwn')
|
||||
@mock.patch.object(fc.WindowsFCConnector, 'get_volume_paths')
|
||||
|
|
Loading…
Reference in New Issue