Make node scanner tests more deterministic #526
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It seems sending and receiving on the same virtual bus1 is flaky. My initial assumption that the flakiness was caused by unordered messages was thus incorrect2.
After fiddling around with this a couple of evenings, I get stable CI runs by using two separate virtual
can.Bus
instances; one for the object we're testing ("TX bus"), and one for validating what's being sent ("RX bus"). We might want to follow this strategy for other parts of the test suite as well. I vaguely remember earlier issues when usingreceive_own_messages=True
and repeatedbus.recv
polling.Footnotes
can.Bus(interface="virtual", receive_own_messages=True)
↩... which is pretty obvious when you browse through the
python-can
source code ↩