Remove the deprecated callback_handler - #1037
Open
xpconanfan wants to merge 5 commits into
Open
xpconanfan wants to merge 5 commits into
xpconanfan wants to merge 5 commits into
Conversation
- Migrate JsonRpcClientBase._rpc() from the deprecated v1 callback_handler to callback_handler_v2.CallbackHandlerV2. - Define _SOCKET_READ_TIMEOUT and _CALLBACK_DEFAULT_TIMEOUT_SEC directly in jsonrpc_client_base.py instead of importing callback_handler.
xpconanfan
force-pushed
the
remove-deprecated-callback-handler
branch
2 times, most recently
from
September 29, 2026 12:59
a7ab001 to
6d941e0
Compare
xpconanfan
force-pushed
the
remove-deprecated-callback-handler
branch
from
September 29, 2026 16:35
6d941e0 to
0e215be
Compare
Unblocks the hanging `windows-latest, 3.14` CI job on this PR. Tests in `snippet_client_v2_test.py` leave `SnippetClientV2` objects with `host_port` set. When those objects are garbage collected later, after the test's method-scoped adb mocks are gone, `ClientBase.__del__` -> `close_connection()` -> `_stop_port_forwarding()` runs a real `adb forward --list`. Removing `callback_handler_test.py` shifts the allocation pattern and thus where those finalizers fire, which is enough to wedge the Windows + Python 3.14 runner mid-session. * `snippet_client_v2_test.py`: add a cleanup that clears `host_port` on the client and its event client so the finalizer is a no-op. * `android_device_test.py`: mock the standing subprocess in `test_AndroidDevice_snippet_cleanup` so it stops starting a real `adb logcat`, and stop the services at the end of the test. Real `adb` launches during a full `pytest tests` run: 18 -> 0 (measured with a temporary `subprocess.Popen` tracer, 3/3 runs). This is a targeted mitigation; the broader test-isolation guard and the library-side finalizer behavior will be addressed in a follow-up PR.
`JsonRpcClientBase` was the 2016 base class for `Sl4aClient` and the v1 `SnippetClient`. SL4A was removed in #939 and the v1 snippet client in #1021, so nothing in Mobly has subclassed it since. `SnippetClientV2` is built on `mobly.snippet.client_base.ClientBase` instead. The error names it re-exported (`Error`, `ApiError`, `ProtocolError`, `AppStartError`, `AppRestoreConnectionError`) were plain aliases of the classes in `mobly.snippet.errors`; callers should import those directly. Also removes its test and the `tests/lib/jsonrpc_client_test_base.py` helper that only it used, and fixes the copy-pasted class name in `jsonrpc_shell_base_test.py`.
ko1in1u
approved these changes
Oct 3, 2026
This branch has not been deployed
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.
Remove the deprecated
callback_handlercode for good, and fix the defect in unit tests that manifest due to the removal