From 38c6f3af51c1ae6364531deb885af92eeee52186 Mon Sep 17 00:00:00 2001 From: likui Date: Tue, 10 Nov 2020 14:48:15 +0800 Subject: [PATCH] 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 --- tests/detection/test_influxdb.py | 2 +- tests/detection/test_influxdb_relay.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/detection/test_influxdb.py b/tests/detection/test_influxdb.py index de915a17..20378174 100644 --- a/tests/detection/test_influxdb.py +++ b/tests/detection/test_influxdb.py @@ -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]) diff --git a/tests/detection/test_influxdb_relay.py b/tests/detection/test_influxdb_relay.py index bf2ce470..e9bee222 100644 --- a/tests/detection/test_influxdb_relay.py +++ b/tests/detection/test_influxdb_relay.py @@ -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])