commit 23043389826205f04c62a0459bec2b2361c1cc6c Author: wu.chunyang Date: Mon Sep 14 11:28:18 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: I9df3355ed619a66d33559366821b907db2950e65 diff --git a/tests/unit/task/scenarios/authenticate/test_authenticate.py b/tests/unit/task/scenarios/authenticate/test_authenticate.py index 1f6b6e2..599eb36 100644 --- a/tests/unit/task/scenarios/authenticate/test_authenticate.py +++ b/tests/unit/task/scenarios/authenticate/test_authenticate.py @@ -39,7 +39,7 @@ class AuthenticateTestCase(test.ScenarioTestCase): # force glanceclient to actually make the API call, and this # results in a bunch of call().__iter__() and call().__len__() # calls that aren't matched if we use assert_has_calls(). - self.assertItemsEqual( + self.assertCountEqual( self.clients("glance").images.list.call_args_list, [mock.call(name=mock.ANY)] * 5) self._test_atomic_action_timer(scenario_inst.atomic_actions(), @@ -88,7 +88,7 @@ class AuthenticateTestCase(test.ScenarioTestCase): def test_validate_heat(self): scenario_inst = authenticate.ValidateHeat() scenario_inst.run(5) - self.assertItemsEqual( + self.assertCountEqual( self.clients("heat").stacks.list.call_args_list, [mock.call(limit=0)] * 5) self._test_atomic_action_timer(scenario_inst.atomic_actions(), @@ -97,7 +97,7 @@ class AuthenticateTestCase(test.ScenarioTestCase): def test_validate_monasca(self): scenario_inst = authenticate.ValidateMonasca() scenario_inst.run(5) - self.assertItemsEqual( + self.assertCountEqual( self.clients("monasca").metrics.list.call_args_list, [mock.call(limit=0)] * 5) self._test_atomic_action_timer(scenario_inst.atomic_actions(),