Skip to content

Commit

Permalink
Allow one spurious message post disabling timers
Browse files Browse the repository at this point in the history
  • Loading branch information
erlend-aasland committed Jul 10, 2024
1 parent 0277ad3 commit bd71065
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion test/test_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,12 @@ def periodicity():

# Stop the task.
task.stop()
self.assertIsNone(self.network.bus.recv(TIMEOUT))
# A message may have been in flight when we stopped the timer,
# so allow a single failure.
bus = self.network.bus
msg = bus.recv(TIMEOUT)
if msg:
self.assertIsNone(bus.recv(TIMEOUT))


class TestScanner(unittest.TestCase):
Expand Down
6 changes: 5 additions & 1 deletion test/test_nmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,11 @@ def test_nmt_master_node_guarding(self):
self.assertEqual(msg.dlc, 0)

self.node.nmt.stop_node_guarding()
self.assertIsNone(self.bus.recv(self.TIMEOUT))
# A message may have been in flight when we stopped the timer,
# so allow a single failure.
msg = self.bus.recv(self.TIMEOUT)
if msg:
self.assertIsNone(self.bus.recv(self.TIMEOUT))


class TestNmtSlave(unittest.TestCase):
Expand Down

0 comments on commit bd71065

Please sign in to comment.