Skip to content

tests: add logic scenario helpers#358

Merged
MaStr merged 1 commit intoMaStr:mainfrom
filiplajszczak:tests-logic-scenario-helpers
May 1, 2026
Merged

tests: add logic scenario helpers#358
MaStr merged 1 commit intoMaStr:mainfrom
filiplajszczak:tests-logic-scenario-helpers

Conversation

@filiplajszczak
Copy link
Copy Markdown
Contributor

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.

@MaStr
Copy link
Copy Markdown
Owner

MaStr commented May 1, 2026

@filiplajszczak Can you solve the conflict please? I can also push the Copilot to do it. As you wish

MaStr
MaStr previously approved these changes May 1, 2026
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 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.py with shared constants plus make_logic, make_calc_input, and target_usable_energy.
  • Add tests/batcontrol/logic/conftest.py autouse fixture to reset the CommonLogic singleton between tests.
  • Refactor test_min_grid_charge_soc_live_cases.py to 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.

Comment thread tests/batcontrol/logic/helpers.py Outdated
Comment thread tests/batcontrol/logic/helpers.py
@MaStr MaStr merged commit cbdf918 into MaStr:main May 1, 2026
10 checks passed
@MaStr
Copy link
Copy Markdown
Owner

MaStr commented May 1, 2026

@filiplajszczak Thank you

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