scripts: west: commands: tests: dfu_util: fix test under Python 3.12
Use "call_args_list" from unittest.mock instead of "called_with" for
verifying the arguments supplied to the dfu-util west runner.
This aligns the assert with the rest of the test case and fixes the
dfu-util west runner test when running under Python 3.12.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
diff --git a/scripts/west_commands/tests/test_dfu_util.py b/scripts/west_commands/tests/test_dfu_util.py
index 9ae4b1c..a28522c 100644
--- a/scripts/west_commands/tests/test_dfu_util.py
+++ b/scripts/west_commands/tests/test_dfu_util.py
@@ -86,7 +86,7 @@
with patch('os.path.isfile', side_effect=os_path_isfile_patch):
runner.run('flash')
assert find_device.called
- assert req.called_with(exe)
+ assert req.call_args_list == [call(exe)]
assert cc.call_args_list == [call(EXPECTED_COMMAND[tc])]
def get_flash_address_patch(args, bcfg):
@@ -141,5 +141,5 @@
cfg = None
map_tc = (exe or DFU_UTIL, alt, cfg, img or RC_KERNEL_BIN)
assert find_device.called
- assert req.called_with(exe)
+ assert req.call_args_list == [call(exe or DFU_UTIL)]
assert cc.call_args_list == [call(EXPECTED_COMMAND[map_tc])]