Skip to content

Commit

Permalink
Replace assertItemsEqual with assertCountEqual
Browse files Browse the repository at this point in the history
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
  • Loading branch information
likui committed Nov 10, 2020
1 parent b7179b7 commit 38c6f3a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/detection/test_influxdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def _build_config(self, http_enabled=True, process_up=True):
}
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])
Expand Down
2 changes: 1 addition & 1 deletion tests/detection/test_influxdb_relay.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def _build_config(self, process_up=True):
}
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])
Expand Down

0 comments on commit 38c6f3a

Please sign in to comment.