Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions pyocd/subcommands/commander_cmd.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# pyOCD debugger
# Copyright (c) 2021 Chris Reed
# Copyright (c) 2026 Aamir Abdul Azeez
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -72,8 +73,6 @@ def invoke(self) -> int:
cmds = None

# Enter REPL.
PyOCDCommander(self._args, cmds).run()

return 0
return PyOCDCommander(self._args, cmds).run()


18 changes: 18 additions & 0 deletions test/unit/test_cmdline.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# pyOCD debugger
# Copyright (c) 2015,2018-2019,2026 Arm Limited
# Copyright (c) 2022 Chris Reed
# Copyright (c) 2026 Aamir Abdul Azeez
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -15,6 +16,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import argparse
from unittest.mock import Mock

import pytest
from pyocd.utility.compatibility import to_bytes_safe

Expand All @@ -26,6 +30,20 @@
)
from pyocd.core.target import Target
from pyocd.target import normalise_target_type_name
from pyocd.subcommands.commander_cmd import CommanderSubcommand


class TestCommanderSubcommand:
@pytest.mark.parametrize("exit_code", [0, 1, 2, 3, 4])
def test_exit_code(self, monkeypatch, exit_code):
args = argparse.Namespace(commands=None)
commander = Mock()
commander.return_value.run.return_value = exit_code
monkeypatch.setattr("pyocd.subcommands.commander_cmd.PyOCDCommander", commander)

assert CommanderSubcommand(args).invoke() == exit_code
commander.assert_called_once_with(args, None)
commander.return_value.run.assert_called_once_with()

class TestSplitCommandLine(object):
def test_split(self):
Expand Down
Loading