Commit Graph

2 Commits

Author SHA1 Message Date
Ken Sanislo 4c709ecb73 tests: mock the libnotify backend so the suite raises no real notifications
The desktop_notifications tests called the real init/alert/show, which
reach the libnotify daemon — every test run popped real GNOME
notifications titled "MockDevice" and "unknown".

Add an autouse conftest fixture that swaps Notify for a mock in both
desktop_notifications modules (solaar.ui and logitech_receiver). The
tests still exercise the real init/alert/show code paths, but
Notification.show() never reaches the daemon. The fixture returns the
mock; the notification tests now assert show() was actually dispatched
against it, so they verify the path instead of just "didn't crash".
2026-05-21 10:15:12 -04:00
Ken Sanislo eefa37d83f tests: isolate solaar.configuration from the real config file
Tests build FakeDevices named "TestDevice". Any test that touches
device.settings or device.persister without mocking
configuration.persister (e.g. test_device_complex, test_device_battery)
calls the real configuration.persister(), which loads and rewrites
~/.config/solaar/config.yaml — the TestDevice has no stable identity
so it never matches an existing entry, and a fresh blank TestDevice
entry is appended on every test run.

Add an autouse conftest fixture that points configuration's yaml/json
paths at a per-test tmp_path and clears the cached _config. No test
can reach the real config now, and each test starts from an empty
config instead of inheriting entries from earlier tests.
2026-05-21 10:15:12 -04:00