Skip to content

tests: add inverter factory coverage#320

Merged
MaStr merged 1 commit intoMaStr:mainfrom
filiplajszczak:inverter-factory-tests
Apr 13, 2026
Merged

tests: add inverter factory coverage#320
MaStr merged 1 commit intoMaStr:mainfrom
filiplajszczak:inverter-factory-tests

Conversation

@filiplajszczak
Copy link
Copy Markdown
Contributor

This adds coverage for common inverter factory behavior around MQTT creation, max_charge_rate alias 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 manual sys.path setup.

@MaStr One tooling question in the same spirit: would you be open to using uv in CI/setup instead of pip? I noticed the project is currently pinned to an older uv line in pyproject.toml, so I’m also wondering whether you’d be open to upgrading that pin first, if needed.

@MaStr
Copy link
Copy Markdown
Owner

MaStr commented Apr 13, 2026

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.
After the release of 3.14 (which is another bigger task), I ran into some pip/python issues on my arch system, which would had been solved by having an uv environment.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.py covering MQTT creation, max_charge_rate aliasing, unknown-type rejection, and Fronius config/default mapping.
  • Updated pytest.ini to add pythonpath = src for 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.

Comment thread tests/batcontrol/inverter/test_inverter_factory.py
Comment thread tests/batcontrol/inverter/test_inverter_factory.py
Comment thread pytest.ini
@@ -1,5 +1,6 @@
[pytest]
testpaths = tests
pythonpath = src
@MaStr MaStr merged commit b9e68ba into MaStr:main Apr 13, 2026
14 checks passed
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.

3 participants