From ee7de7c83944c60c9d6524a99f2895a87e39cdfc Mon Sep 17 00:00:00 2001 From: gugug Date: Sun, 12 Jul 2020 11:21:20 +0800 Subject: [PATCH] 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: Id2be00858df975e3ee6f8e12f7650e936d99d46b --- .../tests/v1/overcloud_image/test_overcloud_image.py | 6 +++--- tripleoclient/tests/v1/undercloud/minion/test_install.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tripleoclient/tests/v1/overcloud_image/test_overcloud_image.py b/tripleoclient/tests/v1/overcloud_image/test_overcloud_image.py index 11f4c9905..ba19f6cb7 100644 --- a/tripleoclient/tests/v1/overcloud_image/test_overcloud_image.py +++ b/tripleoclient/tests/v1/overcloud_image/test_overcloud_image.py @@ -1129,7 +1129,7 @@ class TestUploadOnlyExisting(TestPluginV1): self.cmd.take_action(parsed_args) # ensure check_file_exists has not been called - self.assertItemsEqual( + self.assertCountEqual( self.cmd.adapter.check_file_exists.call_args_list, [mock.call(self.cmd.adapter, './ironic-python-agent.initramfs'), mock.call(self.cmd.adapter, './ironic-python-agent.kernel')]) @@ -1194,7 +1194,7 @@ class TestUploadOnlyExisting(TestPluginV1): self.cmd.take_action(parsed_args) # ensure check_file_exists has been called just with ipa - self.assertItemsEqual( + self.assertCountEqual( self.cmd.adapter.check_file_exists.call_args_list, [mock.call(self.cmd.adapter, './ironic-python-agent.initramfs'), mock.call(self.cmd.adapter, './ironic-python-agent.kernel')] @@ -1226,7 +1226,7 @@ class TestUploadOnlyExisting(TestPluginV1): self.cmd.take_action(parsed_args) # ensure check_file_exists has been called just with ipa - self.assertItemsEqual( + self.assertCountEqual( self.cmd.adapter.check_file_exists.call_args_list, [mock.call(self.cmd.adapter, './overcloud-full.qcow2')]) diff --git a/tripleoclient/tests/v1/undercloud/minion/test_install.py b/tripleoclient/tests/v1/undercloud/minion/test_install.py index 16ff01402..aef372963 100644 --- a/tripleoclient/tests/v1/undercloud/minion/test_install.py +++ b/tripleoclient/tests/v1/undercloud/minion/test_install.py @@ -77,7 +77,7 @@ class TestMinionInstall(TestPluginV1): dry_run=True, force_stack_update=False, no_validations=True, verbose_level=1) mock_usercheck.assert_called_once() - self.assertItemsEqual(mock_subprocess.call_args_list, []) + self.assertCountEqual(mock_subprocess.call_args_list, []) class TestMinionUpgrade(TestPluginV1):