Improve unit test handling of pending/delayed keyboard actions
This commit is contained in:
parent
6532497bb2
commit
301ce3c025
@ -74,7 +74,14 @@ class KeyboardTest:
|
||||
is_pressed = e[1]
|
||||
self.pins[key_pos].value = is_pressed
|
||||
self.do_main_loop()
|
||||
self.keyboard._main_loop()
|
||||
|
||||
# wait up to 10s for delayed actions to resolve, if there are any
|
||||
timeout = time.time_ns() + 10 * 1_000_000_000
|
||||
while timeout > time.time_ns():
|
||||
self.do_main_loop()
|
||||
if not self.keyboard._timeouts and not self.keyboard._resume_buffer:
|
||||
break
|
||||
assert timeout > time.time_ns(), 'infinite loop detected'
|
||||
|
||||
matching = True
|
||||
for i in range(max(len(hid_reports), len(assert_reports))):
|
||||
|
Loading…
Reference in New Issue
Block a user