tests: add inverter factory coverage#320
Conversation
|
Thank you for that. About the question about switching from pip to uv: 100% yes, but under a different PR please. I tried this a couple of weeks ago and ran in multiple issues (local setup, workflows, Dockerimage and HA repository). If you like to give it a try, I would love to take that one. |
There was a problem hiding this comment.
Pull request overview
Adds new pytest coverage for the inverter factory to validate common configuration behavior and inverter instantiation, and updates pytest configuration to simplify imports from src/.
Changes:
- Added
tests/batcontrol/inverter/test_inverter_factory.pycovering MQTT creation,max_charge_ratealiasing, unknown-type rejection, and Fronius config/default mapping. - Updated
pytest.inito addpythonpath = srcfor cleaner import-path handling.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tests/batcontrol/inverter/test_inverter_factory.py | New tests validating factory behavior for MQTT and Fronius inverters and error handling. |
| pytest.ini | Adds src to pytest’s import path to avoid per-test sys.path setup. |
| @@ -1,5 +1,6 @@ | |||
| [pytest] | |||
| testpaths = tests | |||
| pythonpath = src | |||
This adds coverage for common inverter factory behavior around MQTT creation,
max_charge_ratealias handling, unknown type rejection, and Fronius config/default mapping. Backend-specific behavior stays in backend-specific test files.It also switches pytest import-path handling to
pythonpath = src, so the new test file does not need manualsys.pathsetup.@MaStr One tooling question in the same spirit: would you be open to using
uvin CI/setup instead ofpip? I noticed the project is currently pinned to an olderuvline inpyproject.toml, so I’m also wondering whether you’d be open to upgrading that pin first, if needed.