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: I5f6a90b964091daa354652d4ac12c02164066be1
This commit is contained in:
parent
247f54d71e
commit
869d3c13e8
|
@ -248,7 +248,7 @@ class TestCli(base.TestCase):
|
|||
for dev in sanity_devices:
|
||||
self.assertIn(dev, stdout_yaml)
|
||||
self.assertEqual(stdout_yaml, stdout_json)
|
||||
self.assertItemsEqual(sriov_config_yaml, sriov_config_json)
|
||||
self.assertCountEqual(sriov_config_yaml, sriov_config_json)
|
||||
|
||||
def test_sriov_vf_with_dpdk_noop_output(self):
|
||||
def test_get_vf_devname(device, vfid):
|
||||
|
@ -285,7 +285,7 @@ class TestCli(base.TestCase):
|
|||
for dev in sanity_devices:
|
||||
self.assertIn(dev, stdout_yaml)
|
||||
self.assertEqual(stdout_yaml, stdout_json)
|
||||
self.assertItemsEqual(sriov_config_yaml, sriov_config_json)
|
||||
self.assertCountEqual(sriov_config_yaml, sriov_config_json)
|
||||
|
||||
def test_ovs_dpdk_bond_noop_output(self):
|
||||
ivs_yaml = os.path.join(SAMPLE_BASE, 'ovs_dpdk_bond.yaml')
|
||||
|
|
|
@ -835,7 +835,7 @@ class TestBridge(base.TestCase):
|
|||
"""
|
||||
bridge = objects.object_from_json(json.loads(data))
|
||||
self.assertTrue(3 == len(bridge.ovs_extra))
|
||||
self.assertItemsEqual(["bar",
|
||||
self.assertCountEqual(["bar",
|
||||
"set bridge br-foo fail_mode=standalone",
|
||||
"del-controller br-foo"],
|
||||
bridge.ovs_extra)
|
||||
|
@ -849,7 +849,7 @@ class TestBridge(base.TestCase):
|
|||
}
|
||||
"""
|
||||
bridge = objects.object_from_json(json.loads(data))
|
||||
self.assertItemsEqual(["bar",
|
||||
self.assertCountEqual(["bar",
|
||||
"set bridge br-foo fail_mode=standalone",
|
||||
"del-controller br-foo"],
|
||||
bridge.ovs_extra)
|
||||
|
|
Loading…
Reference in New Issue