DriverParamsMixin#210
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a new DriverParamsMixin and applies it to Peripheral to capture driver init parameters automatically (and to avoid object.__init__ receiving unexpected **kwargs). It also adjusts peripheral creation logic and expands unit tests around peripheral behavior and the new mixin.
Changes:
- Added
qtoggleserver.utils.driver_params.DriverParamsMixinand used it as a base forPeripheral(removing explicitparams/driverfields fromPeripheral). - Updated peripheral factory (
qtoggleserver/peripherals/__init__.py:add) to mergeparamsinto constructor kwargs. - Expanded unit tests for peripherals and added new tests for
DriverParamsMixin; minor refactor in port JSON serialization.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
qtoggleserver/utils/driver_params.py |
New mixin to capture init kwargs into _params and store _driver. |
qtoggleserver/peripherals/peripheral.py |
Peripheral now inherits DriverParamsMixin; uses get_params() for deterministic auto-id hashing. |
qtoggleserver/peripherals/__init__.py |
Adjusts peripheral construction by merging params into kwargs (needs sanitization fixes). |
tests/unit/qtoggleserver/utils/test_driver_params.py |
New regression tests for the mixin (currently contains failing/ineffective assertions). |
tests/unit/qtoggleserver/peripherals/test_peripheral.py |
Adds/updates tests for online state, deterministic IDs, and port/runner management. |
qtoggleserver/core/ports.py |
Uses get_last_read_value() in JSON serialization. |
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.
No description provided.