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: I7ea008e1d1b83b9ad264b6846de8ab16780c9528
This commit is contained in:
wangzihao 2020-09-18 18:20:32 +08:00
parent e021416e60
commit b1db20006f
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])