Skip to content

Commit 1b23aac

Browse files
committed
riotctrl.tests: add test for RIOTCtrl.flash
1 parent 4d152f7 commit 1b23aac

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

riotctrl/tests/ctrl_test.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,28 @@ def test_riotctrl_curdir():
5252
os.environ.update(_environ)
5353

5454

55+
def test_riotctrl_flash(monkeypatch):
56+
"""Test the flash method of a riotctrl."""
57+
args = []
58+
kwargs = []
59+
60+
def make_run_mock(self, *_args, **_kwargs):
61+
"""
62+
Mocks RIOTCtrl's make_run method
63+
"""
64+
# pylint: disable=unused-argument
65+
args.append(_args)
66+
kwargs.append(_kwargs)
67+
68+
monkeypatch.setattr(riotctrl.ctrl.RIOTCtrl, 'make_run', make_run_mock)
69+
ctrl = riotctrl.ctrl.RIOTCtrl(APPLICATIONS_DIR)
70+
ctrl.flash()
71+
assert len(args) == len(kwargs) == 1
72+
assert args[-1] == (riotctrl.ctrl.RIOTCtrl.FLASH_TARGETS,)
73+
assert kwargs[-1] == {'stderr': riotctrl.ctrl.DEVNULL,
74+
'stdout': riotctrl.ctrl.DEVNULL}
75+
76+
5577
@pytest.fixture(name='app_pidfile_env')
5678
def fixture_app_pidfile_env():
5779
"""Environment to use application pidfile"""

0 commit comments

Comments
 (0)