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: I1b269b5c06a99e8f62f7c5a33b2314de06389041
This commit is contained in:
likui 2020-11-10 14:48:15 +08:00
parent b7179b7dc2
commit 38c6f3af51
2 changed files with 2 additions and 2 deletions

View File

@ -180,7 +180,7 @@ class TestInfluxDBDetection(base.BaseTestCase):
}
built_config = self._ir.build_config()
self.assertItemsEqual(monitored_items, built_config.keys())
self.assertCountEqual(monitored_items, built_config.keys())
for key in built_config.keys():
if key == 'process':
self._verify_process_conf(built_config[key])

View File

@ -171,7 +171,7 @@ class TestInfluxDBRelayDetection(base.BaseTestCase):
}
built_config = self._ir.build_config()
self.assertItemsEqual(monitored_items, built_config.keys())
self.assertCountEqual(monitored_items, built_config.keys())
for key in built_config.keys():
if key == 'process':
self._verify_process_conf(built_config[key])