This fixes race conditions in the test_buzz_message and test_fractional_buzz_duration power board tests.
Previously, clear_queue would be called immediately after initialising the Robot instance. If the board runner subprocess hasn't had time to decode the packets sent by Robot.__init__ before clear_queue was called, then these packets will end up at the head of the queue after the call to clear_queue. This means that the check to see if the packet at the head of the queue is buzz packet sometimes fails, depending on the nondeterministicness of the process scheduler.
See inline comment.
This fixes race conditions in the
test_buzz_message
andtest_fractional_buzz_duration
power board tests.Previously,
clear_queue
would be called immediately after initialising theRobot
instance. If the board runner subprocess hasn't had time to decode the packets sent byRobot.__init__
beforeclear_queue
was called, then these packets will end up at the head of the queue after the call toclear_queue
. This means that the check to see if the packet at the head of the queue isbuzz
packet sometimes fails, depending on the nondeterministicness of the process scheduler.