tests: add logic scenario helpers#358
Merged
MaStr merged 1 commit intoMaStr:mainfrom May 1, 2026
Merged
Conversation
Owner
|
@filiplajszczak Can you solve the conflict please? I can also push the Copilot to do it. As you wish |
MaStr
previously approved these changes
May 1, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds shared helper utilities for battery-control logic scenario tests and refactors the “min grid-charge SoC” live-case regression tests to use those helpers, reducing repetitive setup and making future scenario characterization tests more readable.
Changes:
- Introduce
tests/batcontrol/logic/helpers.pywith shared constants plusmake_logic,make_calc_input, andtarget_usable_energy. - Add
tests/batcontrol/logic/conftest.pyautouse fixture to reset theCommonLogicsingleton between tests. - Refactor
test_min_grid_charge_soc_live_cases.pyto use the new helpers and remove duplicated local setup functions/constants.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/batcontrol/logic/test_min_grid_charge_soc_live_cases.py | Uses shared helpers for scenario setup; removes duplicated singleton reset + input/logic builders. |
| tests/batcontrol/logic/helpers.py | New shared helper functions/constants for constructing logic instances and calculation inputs. |
| tests/batcontrol/logic/conftest.py | New autouse fixture to reset CommonLogic singleton between tests in this test package. |
9dd9e9d to
2b8b38e
Compare
MaStr
approved these changes
May 1, 2026
Owner
|
@filiplajszczak Thank you |
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.
Add shared helpers for logic scenario tests and convert the min grid-charge live-case tests to use them.
This reduces repeated
CommonLogic,CalculationInput, and SoC setup, making future price-window/grid-charge characterization tests easier to read.