chore: add socket based tests for the new APIs#677
Merged
allenporter merged 2 commits intoPython-roborock:mainfrom Dec 17, 2025
Merged
chore: add socket based tests for the new APIs#677allenporter merged 2 commits intoPython-roborock:mainfrom
allenporter merged 2 commits intoPython-roborock:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds socket-based end-to-end tests for MQTT session and local channel APIs, enabling verification of exact byte streams sent and received without requiring actual broker or device connections.
Key Changes
- Introduced E2E tests for MQTT session using fake sockets to simulate broker communication
- Added E2E tests for LocalChannel using mock transports to simulate device connections
- Created test fixtures that mock socket-level communications while exercising real protocol encoding/decoding
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| tests/e2e/init.py | Package initialization for end-to-end tests |
| tests/e2e/test_mqtt_session.py | MQTT session tests with fake broker socket simulation, testing message publishing and receiving |
| tests/e2e/test_local_session.py | Local channel tests with mock transport connections, testing device connection handshake and command sending |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d370e9b to
e133ab9
Compare
This adds socket based tests for the new API so we can have tests that exercise the exact byte streams that are sent and received, similar to the old API. These currently are testing the lower level "session" and "channel" just to get the request infrastructure ready to be used in a real end to end device manaver tests. This violates our rule that tests align with a module, but this is an exception given its for end to end tests.
a495d26 to
6cbf35b
Compare
Lash-L
approved these changes
Dec 17, 2025
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.
This adds socket based tests for the new API so we can have tests that exercise the exact byte streams that are sent and received, similar to the old API. These currently are testing the lower level "session" and "channel" just to get the request infrastructure ready to be used in a real end to end device manager tests (and will be extended to use #676).
This violates our rule that tests align with a module, but this is an exception given its for end to end tests. They are added to a separate module so that we don't always need to run them.