-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Python 3.12 unittest compatibility
Python 3.12 has removed long-deprecated unittest features [1], therefore some of the existing unit test fail when run on Python 3.12. This patch replaces the 'assertEquals' with 'assertTrue' or 'assertFalse', depending on the usage. This patch also fixes the 'test_amqp_changed' and 'test_amqp_departed' test methods which improperly called 'called_with' which is no longer a valid assertion method [2]. And in fact on Python < 3.12 the 'test_amqp_changed' and 'test_amqp_departed' pass their assertions, when they actually should fail due to the out-of-sync with 'amqp-relation-changed' and 'amqp-relation-departed' hook code. In this case the 'called_with' is replaced with 'assert_called_once'. [1] https://docs.python.org/3.12/whatsnew/3.12.html#id3 [2] python/cpython#100690 Change-Id: I90b400f6bafe8f03f04f991d9fe58635d19b8b2e Signed-off-by: Marcin Wilk <[email protected]>
- Loading branch information
Marcin Wilk
committed
Sep 20, 2024
1 parent
0a004b2
commit 6346564
Showing
2 changed files
with
13 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters