From bf598848b13a9957bc8e037a4efc7b37b4b97ddd Mon Sep 17 00:00:00 2001 From: Henrik Brix Andersen Date: Wed, 25 Oct 2023 12:39:42 +0200 Subject: [PATCH] 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 --- scripts/west_commands/tests/test_dfu_util.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/west_commands/tests/test_dfu_util.py b/scripts/west_commands/tests/test_dfu_util.py index 9ae4b1ce99b947..a28522cd81b37d 100644 --- a/scripts/west_commands/tests/test_dfu_util.py +++ b/scripts/west_commands/tests/test_dfu_util.py @@ -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])]