Skip to content

DriverParamsMixin#210

Merged
ccrisan merged 4 commits into
mainfrom
feature/driver-params-mixin
Jun 20, 2026
Merged

DriverParamsMixin#210
ccrisan merged 4 commits into
mainfrom
feature/driver-params-mixin

Conversation

@ccrisan

@ccrisan ccrisan commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.DriverParamsMixin and used it as a base for Peripheral (removing explicit params/driver fields from Peripheral).
  • Updated peripheral factory (qtoggleserver/peripherals/__init__.py:add) to merge params into 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.

Comment thread qtoggleserver/utils/driver_params.py Outdated
Comment thread tests/unit/qtoggleserver/utils/test_driver_params.py
Comment thread tests/unit/qtoggleserver/utils/test_driver_params.py Outdated
Comment thread qtoggleserver/peripherals/__init__.py
@ccrisan ccrisan merged commit ec04463 into main Jun 20, 2026
7 checks passed
@ccrisan ccrisan deleted the feature/driver-params-mixin branch June 20, 2026 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants