From c636ad293c4b127e4b6678399b6eaed566328663 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Tue, 23 Jun 2020 14:17:30 +0200 Subject: [PATCH] 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: I1641af07b21925402490f0b7dfee5314f416dde8 --- glance/tests/unit/v2/test_images_resource.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glance/tests/unit/v2/test_images_resource.py b/glance/tests/unit/v2/test_images_resource.py index 74911b99e7..9c3ca2fee7 100644 --- a/glance/tests/unit/v2/test_images_resource.py +++ b/glance/tests/unit/v2/test_images_resource.py @@ -4563,7 +4563,7 @@ class TestImagesSerializer(test_utils.BaseTestCase): self.assertEqual(http.CREATED, response.status_int) header_value = response.headers.get(header_name) self.assertIsNotNone(header_value) - self.assertItemsEqual(enabled_methods, header_value.split(',')) + self.assertCountEqual(enabled_methods, header_value.split(',')) # check single method self.config(enabled_import_methods=['swift-party-time'])