Skip to content

Commit 1412c0f

Browse files
Filip Jagodzinski0xc0170
authored andcommitted
Tests: Watchdog: Fix config access in the host script
Move the calls to get_config_item() to the setup() method. The config is not available in the initializer yet.
1 parent ed78b4a commit 1412c0f

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

TESTS/host_tests/reset_reason.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,14 @@ def __init__(self):
6868
super(ResetReasonTest, self).__init__()
6969
self.device_has_watchdog = None
7070
self.raw_reset_reasons = set()
71-
cycle_s = self.get_config_item('program_cycle_s')
72-
self.program_cycle_s = cycle_s if cycle_s is not None else DEFAULT_CYCLE_PERIOD
71+
self.program_cycle_s = DEFAULT_CYCLE_PERIOD
7372
self.test_steps_sequence = self.test_steps()
7473
# Advance the coroutine to it's first yield statement.
7574
self.test_steps_sequence.send(None)
7675

7776
def setup(self):
77+
cycle_s = self.get_config_item('program_cycle_s')
78+
self.program_cycle_s = cycle_s if cycle_s is not None else DEFAULT_CYCLE_PERIOD
7879
self.register_callback(MSG_KEY_DEVICE_READY, self.cb_device_ready)
7980
self.register_callback(MSG_KEY_RESET_REASON_RAW, self.cb_reset_reason_raw)
8081
self.register_callback(MSG_KEY_RESET_REASON, self.cb_reset_reason)

TESTS/host_tests/sync_on_reset.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,11 @@ class SyncOnReset(BaseHostTest):
4747
def __init__(self):
4848
super(SyncOnReset, self).__init__()
4949
self.test_case_num = 0
50-
cycle_s = self.get_config_item('program_cycle_s')
51-
self.program_cycle_s = cycle_s if cycle_s is not None else DEFAULT_CYCLE_PERIOD
50+
self.program_cycle_s = DEFAULT_CYCLE_PERIOD
5251

5352
def setup(self):
53+
cycle_s = self.get_config_item('program_cycle_s')
54+
self.program_cycle_s = cycle_s if cycle_s is not None else DEFAULT_CYCLE_PERIOD
5455
self.register_callback(MSG_KEY_DEVICE_READY, self.cb_device_ready)
5556
self.register_callback(MSG_KEY_DEVICE_RESET, self.cb_device_reset)
5657

TESTS/host_tests/watchdog_reset.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ def __init__(self):
4949
super(WatchdogReset, self).__init__()
5050
self.current_case = TestCaseData(0, CASE_DATA_INVALID)
5151
self.__handshake_timer = None
52-
cycle_s = self.get_config_item('program_cycle_s')
53-
self.program_cycle_s = cycle_s if cycle_s is not None else DEFAULT_CYCLE_PERIOD
52+
self.program_cycle_s = DEFAULT_CYCLE_PERIOD
5453
self.drop_heartbeat_messages = True
5554
self.hb_timestamps_us = []
5655

@@ -94,6 +93,8 @@ def heartbeat_timeout_handler(self):
9493
self.current_case = TestCaseData(self.current_case.index, dev_data)
9594

9695
def setup(self):
96+
cycle_s = self.get_config_item('program_cycle_s')
97+
self.program_cycle_s = cycle_s if cycle_s is not None else DEFAULT_CYCLE_PERIOD
9798
self.register_callback(MSG_KEY_DEVICE_READY, self.cb_device_ready)
9899
self.register_callback(MSG_KEY_DEVICE_RESET, self.cb_device_reset)
99100
self.register_callback(MSG_KEY_HEARTBEAT, self.cb_heartbeat)

0 commit comments

Comments
 (0)