Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions test/simplecyclic_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class SimpleCyclicSendTaskTest(unittest.TestCase, ComparingMessagesTestCase):

def __init__(self, *args, **kwargs):
unittest.TestCase.__init__(self, *args, **kwargs)
ComparingMessagesTestCase.__init__(self, allowed_timestamp_delta=None, preserves_channel=True)
ComparingMessagesTestCase.__init__(self, allowed_timestamp_delta=0.016, preserves_channel=True)

@unittest.skipIf(IS_CI, "the timing sensitive behaviour cannot be reproduced reliably on a CI server")
def test_cycle_time(self):
Expand All @@ -36,8 +36,19 @@ def test_cycle_time(self):
self.assertTrue(80 <= size <= 120,
'100 +/- 20 messages should have been transmitted. But queue contained {}'.format(size))
last_msg = bus2.recv()
self.assertMessageEqual(last_msg, msg)

next_last_msg = bus2.recv()
# Check consecutive messages are spaced properly in time and have
# the same id/data
self.assertMessageEqual(last_msg, next_last_msg)


# Check the message id/data sent is the same as message received
# Set timestamp and channel to match recv'd because we don't care
# and they are not initialized by the can.Message constructor.
msg.timestamp = last_msg.timestamp
msg.channel = last_msg.channel
self.assertMessageEqual(msg, last_msg)

bus1.shutdown()
bus2.shutdown()

Expand Down