Replace assertItemsEqual with assertEqual

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 assertEqual.

[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: If9ed6624afb277f1d09e5c5a2b7073de85d467d4
This commit is contained in:
likui 2020-11-02 12:54:19 +08:00
parent 181ae65216
commit 6aa0fa3561
1 changed files with 3 additions and 1 deletions

View File

@ -338,7 +338,9 @@ class TaggedAttachmentsTest(DeviceTaggingBase):
found_devices = [d['tags'][0] for d in md_dict['devices']
if d.get('tags')]
try:
self.assertItemsEqual(found_devices, ['nic-tag', 'volume-tag'])
self.assertEqual(
sorted(found_devices),
sorted(['nic-tag', 'volume-tag']))
return True
except Exception:
return False