Skip to content

Commit f848e9f

Browse files
bhass1felixdivo
authored andcommitted
Fixed simplecyclic test
Originally, the testcase would fail because timestamps would not match. This was due to a Can.Message being initialized had a timestamp value of 0, while a recv'd message had a virtual timestamp. When compared they never matched. Modified testcase now allows for some variation (0.016 s) in the timestamp for a 0.01 s periodic message and compares the last message with the next last message.
1 parent dd89de4 commit f848e9f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

test/simplecyclic_test.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class SimpleCyclicSendTaskTest(unittest.TestCase, ComparingMessagesTestCase):
2020

2121
def __init__(self, *args, **kwargs):
2222
unittest.TestCase.__init__(self, *args, **kwargs)
23-
ComparingMessagesTestCase.__init__(self, allowed_timestamp_delta=None, preserves_channel=True)
23+
ComparingMessagesTestCase.__init__(self, allowed_timestamp_delta=0.016, preserves_channel=True)
2424

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

4142
bus1.shutdown()
4243
bus2.shutdown()

0 commit comments

Comments
 (0)