From c2abd827dba4828aa364d22e153221bf73e9ccbb Mon Sep 17 00:00:00 2001 From: gugug Date: Sun, 12 Jul 2020 11:25:13 +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: I2edc09748de1739c558040a8ae6a15373ad1a93b --- .../tests/api/identity/v3/test_identity_providers.py | 2 +- .../tests/api/identity/v3/test_mapping_rules.py | 2 +- .../tests/api/identity/v3/test_oauth1_tokens.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/keystone_tempest_plugin/tests/api/identity/v3/test_identity_providers.py b/keystone_tempest_plugin/tests/api/identity/v3/test_identity_providers.py index fef14ea..77060e0 100644 --- a/keystone_tempest_plugin/tests/api/identity/v3/test_identity_providers.py +++ b/keystone_tempest_plugin/tests/api/identity/v3/test_identity_providers.py @@ -38,7 +38,7 @@ class IndentityProvidersTest(base.BaseIdentityTest): self.assertEqual(idp_ref['enabled'], idp['enabled']) if 'remote_ids' in idp_ref: - self.assertItemsEqual(idp_ref['remote_ids'], idp['remote_ids']) + self.assertCountEqual(idp_ref['remote_ids'], idp['remote_ids']) def _create_idp(self, idp_id, idp_ref): idp = self.idps_client.create_identity_provider( diff --git a/keystone_tempest_plugin/tests/api/identity/v3/test_mapping_rules.py b/keystone_tempest_plugin/tests/api/identity/v3/test_mapping_rules.py index 7fcf376..58790a5 100644 --- a/keystone_tempest_plugin/tests/api/identity/v3/test_mapping_rules.py +++ b/keystone_tempest_plugin/tests/api/identity/v3/test_mapping_rules.py @@ -32,7 +32,7 @@ class MappingRulesTest(base.BaseIdentityTest): self.assertIn('rules', mapping) if mapping_ref: - self.assertItemsEqual(mapping_ref['rules'], mapping['rules']) + self.assertCountEqual(mapping_ref['rules'], mapping['rules']) def _create_mapping_rule(self, mapping_id, mapping_ref): mapping = self.mappings_client.create_mapping_rule( diff --git a/keystone_tempest_plugin/tests/api/identity/v3/test_oauth1_tokens.py b/keystone_tempest_plugin/tests/api/identity/v3/test_oauth1_tokens.py index 849da07..d4f56d8 100644 --- a/keystone_tempest_plugin/tests/api/identity/v3/test_oauth1_tokens.py +++ b/keystone_tempest_plugin/tests/api/identity/v3/test_oauth1_tokens.py @@ -219,7 +219,7 @@ class OAUTH1TokensTest(base.BaseIdentityTest): role_ids = [role['id'] for role in roles['roles']] # check that role ids matches - self.assertItemsEqual(fetched_role_ids, role_ids) + self.assertCountEqual(fetched_role_ids, role_ids) @decorators.idempotent_id('28aee994-86b1-4596-a652-572f558045e7') def test_show_role_for_access_token(self):