-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Network.notifier timeouts customizable (fixes #530) #536
Make Network.notifier timeouts customizable (fixes #530) #536
Conversation
Move the hard-coded 1 second maximum cycle duration passed during can.Notifier construction to a class variable NOTIFIER_CYCLE. Explicitly specify the timeout to stop the notifier in another class variable NOTIFIER_SHUTDOWN_TIMEOUT, matching the default used in python-can. These can be overridden per instance if needed.
Explicitly set the NOTIFIER_SHUTDOWN_TIMEOUT to zero in all Network instances created for unit tests. This reduces total test running time from ~30 to ~9 seconds when run locally.
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #536 +/- ##
==========================================
+ Coverage 71.10% 71.12% +0.01%
==========================================
Files 26 26
Lines 3111 3113 +2
Branches 526 526
==========================================
+ Hits 2212 2214 +2
Misses 769 769
Partials 130 130
|
@erlend-aasland this should replace #535. Note that the actual time for the tests alone varies between 9 and 47 seconds on my machine. It seems the NMT tests timings are not very reproducible mainly. That also explains why this PR is a bit quicker for one check (34 s), but slower for the other (50 s) than the alternative #535. |
You beat me; I was working on a similar PR based on your suggestion 😄 This looks nice! |
Co-authored-by: Erlend E. Aasland <[email protected]>
Move the hard-coded 1 second maximum cycle duration passed during
can.Notifier
construction to a class variableNOTIFIER_CYCLE
.Explicitly specify the timeout to stop the notifier in another class
variable
NOTIFIER_SHUTDOWN_TIMEOUT
, matching the default used inpython-can. These can be overridden per instance if needed.
Do not wait for notifier thread shutdown during tests by explicitly setting the
NOTIFIER_SHUTDOWN_TIMEOUT
to zero in allNetwork
instances created for unit tests.This reduces total test running time from ~30 to ~9 seconds when run locally.