Skip to content

Commit

Permalink
Payloads with DATA1 might still arrive; adjust check for new payload
Browse files Browse the repository at this point in the history
  • Loading branch information
erlend-aasland committed Jul 10, 2024
1 parent 6ec0509 commit 54c17a2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/test_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,22 @@ def periodicity():
return round(delta, ndigits=1) == PERIOD
return False

# Wait for two frames to arrive; then check the result.
# Wait for frames to arrive; then check the result.
with condition:
condition.wait_for(periodicity, TIMEOUT)
self.assertTrue(all(v[0] == DATA1 for v in acc))

# Update task data, which implicitly restarts the timer.
# Wait for two frames to arrive; then check the result.
# Wait for frames to arrive; then check the result.
task.update(DATA2)
with condition:
acc.clear()
condition.wait_for(periodicity, TIMEOUT)
self.assertTrue(all(v[0] == DATA2 for v in acc))
# Find the first message with new data, and verify that all subsequent
# messages also carry the new payload.
data = [v[0] for v in acc]
idx = data.index(DATA2)
self.assertTrue(all(v[0] == DATA2 for v in acc[idx:]))

# Stop the task.
task.stop()
Expand Down

0 comments on commit 54c17a2

Please sign in to comment.