-
-
Notifications
You must be signed in to change notification settings - Fork 26
Test suite overhaul + fixes for the three bugs it uncovered #441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
911c559
ci: run the whole test tree and make the plugin-safety job assert som…
claude ca04820
test: replace can't-fail tests with real assertions
claude dfba88b
test: cover the untested fragile logic (compatibility gate, secrets, …
claude b8b0c8e
test: add drift guards for cross-file contracts
claude d159f28
test: address review feedback — fixture lifecycle, test names, ClassVar
claude dc643b4
ci: allow manual test.yml runs via workflow_dispatch
claude 206eca0
fix: unify version comparison, refuse secret-leaking saves, reset ski…
claude d97a299
fix: harden shared comparator edges from review
claude File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
31 changes: 31 additions & 0 deletions
31
test/fixtures/plugins/ci-fixture-plugin/config_schema.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| { | ||
| "$schema": "http://json-schema.org/draft-07/schema#", | ||
| "title": "CI Fixture Plugin", | ||
| "type": "object", | ||
| "properties": { | ||
| "enabled": { | ||
| "type": "boolean", | ||
| "default": true | ||
| }, | ||
| "display_duration": { | ||
| "type": "number", | ||
| "default": 5 | ||
| }, | ||
| "border_color": { | ||
| "type": "array", | ||
| "items": {"type": "integer", "minimum": 0, "maximum": 255}, | ||
| "minItems": 3, | ||
| "maxItems": 3, | ||
| "default": [0, 255, 0], | ||
| "description": "RGB color of the border rectangle." | ||
| }, | ||
| "diagonal_color": { | ||
| "type": "array", | ||
| "items": {"type": "integer", "minimum": 0, "maximum": 255}, | ||
| "minItems": 3, | ||
| "maxItems": 3, | ||
| "default": [255, 0, 0], | ||
| "description": "RGB color of the diagonals." | ||
| } | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| """ | ||
| CI fixture plugin. | ||
|
|
||
| Exists so the plugin safety harness (test/plugins/test_plugin_matrix.py and | ||
| the plugin-safety CI job) always has at least one real plugin to load and | ||
| render — without it, an empty plugins/ directory turns the whole job into a | ||
| green no-op. The render is deliberately trivial and fully deterministic: | ||
| a border rectangle plus both diagonals, sized from the display manager's | ||
| declared dimensions. No fonts, no network, no time dependence, so golden | ||
| images are stable across platforms. | ||
| """ | ||
|
|
||
| from PIL import ImageDraw | ||
|
|
||
| from src.plugin_system.base_plugin import BasePlugin | ||
|
|
||
|
|
||
| class CIFixturePlugin(BasePlugin): | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| """Deterministic CI-only fixture plugin: renders a border + diagonals | ||
| pattern sized from the display's declared dimensions. Never shipped to | ||
| devices; exists solely so the plugin safety harness has a real plugin | ||
| to exercise in CI.""" | ||
|
|
||
| def update(self) -> None: | ||
| """Nothing to fetch — the render is self-contained.""" | ||
|
|
||
| def display(self, force_clear: bool = False) -> None: | ||
| self.display_manager.clear() | ||
| width = self.display_manager.matrix.width | ||
| height = self.display_manager.matrix.height | ||
| border = tuple(self.config.get("border_color", [0, 255, 0])) | ||
| diagonal = tuple(self.config.get("diagonal_color", [255, 0, 0])) | ||
|
|
||
| image = self.display_manager.image | ||
| draw = ImageDraw.Draw(image) | ||
| # Blank only the declared panel area, then draw edge-to-edge content: | ||
| # the border proves the plugin reads dynamic dimensions (any overflow | ||
| # or underfill at any size is a harness bug or a dimensions bug), the | ||
| # diagonals make golden comparisons sensitive to size/offset drift. | ||
| draw.rectangle([0, 0, width - 1, height - 1], fill=(0, 0, 0)) | ||
| draw.rectangle([0, 0, width - 1, height - 1], outline=border) | ||
| draw.line([0, 0, width - 1, height - 1], fill=diagonal) | ||
| draw.line([0, height - 1, width - 1, 0], fill=diagonal) | ||
| self.display_manager.update_display() | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "id": "ci-fixture-plugin", | ||
| "name": "CI Fixture Plugin", | ||
| "version": "1.0.0", | ||
| "description": "Bundled test fixture so the plugin safety harness always has at least one real plugin to render in CI. Draws a deterministic border + diagonals pattern at any panel size. Not installable from the store and never shipped to devices.", | ||
| "author": "LEDMatrix", | ||
| "entry_point": "manager.py", | ||
| "class_name": "CIFixturePlugin", | ||
| "display_modes": ["ci-fixture"], | ||
| "update_interval": 3600, | ||
| "min_ledmatrix_version": "2.0.0", | ||
| "compatible_versions": [">=2.0.0"] | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # No dependencies — the fixture must load in any environment. | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| # | ||
| # Pillow is deliberately NOT pinned here even though manager.py imports | ||
| # PIL: it is a core LEDMatrix dependency (see the repo-root | ||
| # requirements.txt), so it is always present wherever the harness runs, | ||
| # and the harness loads plugins with install_deps=False anyway. Pinning | ||
| # it here would only invite a needless pip install during test runs. | ||
Binary file added
BIN
+359 Bytes
test/fixtures/plugins/ci-fixture-plugin/test/golden/128x32/ci-fixture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+586 Bytes
test/fixtures/plugins/ci-fixture-plugin/test/golden/128x64/ci-fixture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+849 Bytes
test/fixtures/plugins/ci-fixture-plugin/test/golden/128x96/ci-fixture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.15 KB
test/fixtures/plugins/ci-fixture-plugin/test/golden/256x128/ci-fixture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+395 Bytes
test/fixtures/plugins/ci-fixture-plugin/test/golden/256x32/ci-fixture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+319 Bytes
test/fixtures/plugins/ci-fixture-plugin/test/golden/64x32/ci-fixture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+466 Bytes
test/fixtures/plugins/ci-fixture-plugin/test/golden/64x64/ci-fixture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+454 Bytes
test/fixtures/plugins/ci-fixture-plugin/test/golden/96x48/ci-fixture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.