charm-neutron-openvswitch/unit_tests
Marcin Wilk 63465640fe 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] https://github.com/python/cpython/issues/100690

Change-Id: I90b400f6bafe8f03f04f991d9fe58635d19b8b2e
Signed-off-by: Marcin Wilk <marcin.wilk@canonical.com>
2024-09-20 19:05:03 +02:00
..
__init__.py Update to run under Python 3 2017-11-20 08:54:31 -08:00
16.07-dpdk-openvswitch-switch Migrate openvswitch-switch file to avoid restarts 2017-08-23 15:39:36 -07:00
16.10-openvswitch-switch Migrate openvswitch-switch file to avoid restarts 2017-08-23 15:39:36 -07:00
package-provided-openvswitch-switch Migrate openvswitch-switch file to avoid restarts 2017-08-23 15:39:36 -07:00
pci_responses.py Update to run under Python 3 2017-11-20 08:54:31 -08:00
test_actions_cleanup.py Add cleanup action and OVS to OVN migration test 2020-09-11 16:30:52 +02:00
test_neutron_ovs_context.py Updates for caracal testing support 2024-03-25 14:20:29 +00:00
test_neutron_ovs_hooks.py Fix Python 3.12 unittest compatibility 2024-09-20 19:05:03 +02:00
test_neutron_ovs_utils.py Fix Python 3.12 unittest compatibility 2024-09-20 19:05:03 +02:00
test_os_actions.py Use unittest.mock instead of mock 2021-12-15 14:11:43 +00:00
test_pci_helper.py Use unittest.mock instead of mock 2021-12-15 14:11:43 +00:00
test_pci.py Use unittest.mock instead of mock 2021-12-15 14:11:43 +00:00
test_utils.py Use unittest.mock instead of mock 2021-12-15 14:11:43 +00:00