test(viewer): cover gst_fbdev_player.main() and its callbacks (35% → 98%) - #3237
Merged
Merged
Conversation
gst_fbdev_player.py sat at ~35% coverage — the pure helpers were tested but main(), the GStreamer/GLib entry point (playbin build, bus error/EOS/rebuild logic, CAPS pad probe, about-to-finish, SIGTERM), was not, because it lazily imports gi/Gst/GLib and runs a blocking GLib.MainLoop. Add a harness that stubs the gi stack in sys.modules and drives the pipeline through mocks: the nested callbacks are captured from the mock .connect()/.add_probe()/signal.signal() calls and invoked with fake Gst messages/events, so the loop logic is exercised without a real GStreamer runtime. Raises the module to 98% (0 statements uncovered). Split out of the ruff-ruleset PR (Screenly#3224) whose codecov report flagged these lines — this is a standalone coverage improvement. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01HJ3ucEkn62cbgPoisAZ5LQ
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3237 +/- ##
=========================================
Coverage ? 90.81%
=========================================
Files ? 76
Lines ? 8352
Branches ? 884
=========================================
Hits ? 7585
Misses ? 549
Partials ? 218 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
vpetersson
approved these changes
Aug 3, 2026
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.



Standalone test-coverage improvement for the GStreamer fbdev player (Pi 1/2/3 video path).
Why
src/anthias_viewer/gst_fbdev_player.pysat at ~35% coverage. Its pure helpers (aspect-fit math, caps composition, argv parsing, fb-clear) were tested, butmain()— the GStreamer/GLib entry point — was not: it lazily importsgi/Gst/GLiband runs a blockingGLib.MainLoop, so it needs the gi stack stubbed to test at all.This was split out of the ruff-ruleset PR (#3224), whose codecov report flagged these lines as uncovered (they got pulled into that diff by reformatting). Per review, the coverage work belongs on its own branch rather than bundled into a lint PR.
What
New
tests/test_gst_fbdev_player_main.pystubsgi/Gst/GLibinsys.modulesand drives the pipeline through mocks. The nested callbacks (bus message, CAPS pad probe, about-to-finish, SIGTERM) are captured from the mock.connect()/.add_probe()/signal.signal()calls and invoked with fake Gst messages/events, so the loop logic runs without a real GStreamer runtime. Covered:return 1)build_and_startfailures: no playbin element, sink-buildGLib.Error,PLAYINGstate failureResult
gst_fbdev_player.py: 35% → 98% (0 statements uncovered; 4 partial branches remain). 21 new tests; mypy + ruff clean; full viewer suite (302 tests) green. No production code changed.🤖 Generated with Claude Code
https://claude.ai/code/session_01HJ3ucEkn62cbgPoisAZ5LQ