Skip to content

Commit

Permalink
scripts: west: commands: tests: dfu_util: fix test under Python 3.12
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
henrikbrixandersen committed Oct 26, 2023
1 parent 4201978 commit bf59884
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/west_commands/tests/test_dfu_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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])]

0 comments on commit bf59884

Please sign in to comment.