Skip to content

Make tests fail when the code they test does nothing - #1191

Merged
frenck merged 1 commit into
mainfrom
frenck/tighten-tests
Oct 3, 2026
Merged

frenck merged 1 commit into
mainfrom
frenck/tighten-tests

Conversation

@frenck

@frenck frenck commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Proposed Changes

(Describe the changes and rationale behind them)

Tests only, no library changes.

  • App and widget tests checked nothing. test_app_next, test_app_previous and test_activate_widget never asserted a request was made, so they kept passing with those methods replaced by no-ops. They now assert the exact request.
  • Zero and off were untested. Nothing tested a volume or brightness of zero, or turning the display off. A truthiness check slipping in where is not None belongs would have quietly broken muting and switching the display off. Two new tests cover that.

Verified by breaking the code on purpose (no-op methods, truthiness checks): all five tests fail against it.

Related Issues

(Github link to related issues or pull requests)

None.

The tests for switching to the next or previous app, and for showing a
widget, never checked that a request was made. They kept passing with
those methods replaced by no-ops.

Nothing tested a volume or brightness of zero, or turning the display
off. A truthiness check slipping in where `is not None` belongs would
have quietly broken muting and switching off.
@frenck frenck added the maintenance Generic maintenance tasks. label Oct 3, 2026
@frenck
frenck merged commit 51d4d6c into main Oct 3, 2026
32 checks passed
@frenck
frenck deleted the frenck/tighten-tests branch October 3, 2026 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Generic maintenance tasks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant