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>
This commit is contained in:
Henrik Brix Andersen 2023-10-25 12:39:42 +02:00 committed by Henrik Brix Andersen
commit bf598848b1

View file

@ -86,7 +86,7 @@ def test_dfu_util_init(cc, req, find_device, tc, runner_config):
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 @@ def test_dfu_util_create(cc, req, gfa, find_device, tc, runner_config, tmpdir):
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])]