Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/instructions/testing.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@ Before changing a test that fails, investigate whether the test is intentionally

A failing test often reveals a production bug, not a test bug.

## Prove a new test can fail

A test that never fails asserts nothing, and reads exactly like one that works.
Before calling a new test done, break what it covers — comment out the constraint, invert the condition — and confirm it goes red, then restore.

Watch for assertions that depend on the problem having a unique answer.
An optimisation test over devices with no incentive to move has the same optimum with or without the constraint, so it passes either way.
In `test_highspy_equivalence.py`, where two backends are compared, also disable the new code path on one side: a scenario that survives that is comparing two no-ops.
Both traps have been hit — a balance-group scenario there passed with the constraint it was named after entirely disabled.

Say in the PR description what you broke to prove it — a reviewer cannot tell a binding test from a vacuous one by reading it.

## Module-scoped fixture state

Module-scoped fixtures are shared across tests. When modifying shared objects (e.g. `asset.sensors_to_show`), reset them to the column default — not to `None` — in teardown:
Expand Down
3 changes: 3 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ Most-missed rules, called out so they are not forgotten:
commit again. See [`pre-commit-hooks.instructions.md`](.github/instructions/pre-commit-hooks.instructions.md).
- **Add a changelog entry** for user-facing changes, in the right section, with a PR link. See
[`changelog.instructions.md`](.github/instructions/changelog.instructions.md).
- **Prove a new test can fail** — break what it covers, confirm it goes red, restore. A test that passes
with the feature disabled asserts nothing. See
[`testing.instructions.md`](.github/instructions/testing.instructions.md).
- **One logical change per commit** ([`atomic-commits.instructions.md`](.github/instructions/atomic-commits.instructions.md)),
**timezone-aware datetimes always** ([`timezone-awareness.instructions.md`](.github/instructions/timezone-awareness.instructions.md)),
**catch specific exceptions** ([`error-handling.instructions.md`](.github/instructions/error-handling.instructions.md)),
Expand Down
Loading