You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When waitForEvent times out, it builds the error message from predicate.__name__. Callables such as functools.partial objects have no __name__, so instead of CallbackHandlerTimeoutError the caller got an AttributeError. This falls back to the callable's type name (for example partial) in CallbackHandlerBase. The added test with a partial predicate fails before the change and passes after it.
Using repr(predicate) includes memory addresses and bound argument reprs (e.g., <my_module.MyPredicate object at 0x7f...> or functools.partial(<function foo at 0x7f...>, ...)), which makes timeout error messages noisy and harder to match in assertions. Can we fall back to the callable's type name instead?
(Also, we are removing the deprecated mobly/controllers/android_device_lib/callback_handler.py in a separate PR, so you can drop the changes to callback_handler.py and callback_handler_test.py from this PR.)
Thanks, good point. Updated to fall back to type(predicate).__name__, and the test now checks that the message names the partial predicate. I also dropped the callback_handler.py change, so the PR only touches CallbackHandlerBase and its test.
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
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.
When
waitForEventtimes out, it builds the error message frompredicate.__name__. Callables such asfunctools.partialobjects have no__name__, so instead ofCallbackHandlerTimeoutErrorthe caller got anAttributeError. This falls back to the callable's type name (for examplepartial) inCallbackHandlerBase. The added test with a partial predicate fails before the change and passes after it.