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
This commit is contained in:
Dirk Mueller 2020-06-23 14:17:30 +02:00
parent e6db0b10a7
commit c636ad293c
1 changed files with 1 additions and 1 deletions

View File

@ -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'])