emcy: catch callback exceptions and expand test coverage#659
Open
friederschueler wants to merge 1 commit intocanopen-python:masterfrom
Open
emcy: catch callback exceptions and expand test coverage#659friederschueler wants to merge 1 commit intocanopen-python:masterfrom
friederschueler wants to merge 1 commit intocanopen-python:masterfrom
Conversation
- Fix bug where an exception in one EMCY callback would abort all subsequent callbacks; now logs the exception and continues - Add test for callback exception handling (verifies fix) - Add tests for EmcyConsumer initialization, multiple callback order, error reset variants, wait timeout edge cases, concurrent errors - Add tests for EmcyError initialization types and str representation - Add tests for EmcyProducer initialization, send/reset edge cases - Add TestEmcyIntegration class using network.subscribe() for producer-consumer roundtrip tests - Remove superfluous inline comments per reviewer feedback (acolomb) - Convert leading comment to docstring in test_emcy_consumer_on_emcy Addresses review feedback from PR canopen-python#604 by yuvraj-kolkar17.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Member
|
It would really help the review process if you based your version on top of the commits in #604. Is that feasible? It will be squashed anyway when merging. |
Collaborator
Author
|
I really tried to rebase this commit to #604 and then apply the changes, but even with AI this didn't work. Instead here is a summary of how #659 addresses your specific review comments on #604:
Additionally, #659 includes the actual bug fix in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What type of PR is this?
/kind bugfix test
/area emcy.py
What this PR does / why we need it
This PR incorporates the review feedback from #604 (by @yuvraj-kolkar17) as suggested by @acolomb, since the original contributor has been unresponsive for several months.
Bug fix in
canopen/emcy.py:An exception raised in one EMCY callback would silently abort all subsequent callbacks in the list. The
on_emcy()loop now wraps each callback intry/exceptand logs the exception, so remaining callbacks are always called.Test improvements in
test/test_emcy.py:test_emcy_consumer_on_emcy# Dispatch …commentstest_emcy_consumer_initialization: verify initial state (without testingthreading.Conditiontype as an implementation detail)test_emcy_consumer_multiple_callbacks: simplified using lambdastest_emcy_consumer_callback_exception_handling: rewritten with lambdas; adds assertionassertEqual(['success1', 'success2'])that verifies the fixtest_emcy_consumer_error_reset_variants: various reset code patternstest_emcy_consumer_wait_timeout_edge_cases: zero/near-zero timeoutstest_emcy_consumer_wait_concurrent_errors: multiple concurrent errorsTestEmcyIntegration: producer-consumer roundtrip tests usingnetwork.subscribe()instead of manualrxbus.recv()callsWhich issue(s) this PR fixes
Closes #604
Does this PR introduce a user-facing change?