Add focused pytest coverage for display and LVGL metadata validation#144
Closed
Copilot wants to merge 2 commits into
Closed
Add focused pytest coverage for display and LVGL metadata validation#144Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
Copilot
AI
changed the title
[WIP] Add pytest coverage for display metadata validation
Add focused pytest coverage for display and LVGL metadata validation
May 27, 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.
This adds targeted pytest coverage for the display metadata / LVGL metadata-validation refactor on
lvgl-endian. The new tests lock in the ID-resolution guard behavior indisplayand the byte-order validation/fallback contract inlvgl.final_validation().Display metadata guard coverage
get_display_metadata()andget_all_display_metadata()using realIDobjects with unresolvedid=None.Duplicate registration coverage
add_metadata()rejects duplicate registration of the sameIDobject.LVGL byte-order validation coverage
byte_ordermetadata.LVGL default fallback coverage
byte_orderand display metadata does not supply one.big_endian.Test fixtures kept narrow
tests/component_tests/display/andtests/component_tests/lvgl/.Example of the guarded metadata contract covered by these tests:
Original prompt
Add focused pytest coverage on branch
lvgl-endianin repositoryclydebarrow/esphometo address remaining test gaps in the display metadata / LVGL metadata-validation refactor.Context:
3edb476c2d6f3501ec34047b7c4aeae24f9de004([lvgl][mipi_spi][mipi_rgb][mipi_dsi] Metadata validation).esphome/components/display/__init__.pynow stores metadata as a list of(ID, DisplayMetaData)tuples and explicitly guards against metadata lookups before IDs have been resolved.esphome/components/lvgl/__init__.pyperforms final validation using display metadata forbyte_order,has_writer,rotation, anddraw_rounding.mipi_spi,mipi_rgb, andmipi_dsiall populate the expanded metadata fields.Please create a pull request against branch
lvgl-endianthat adds pytest cases for the missing/high-value coverage areas below.Required tests to add:
esphome/components/display/__init__.py:get_display_metadata()should assert if metadata contains an unresolvedID(i.e.id_.id is None).get_all_display_metadata()should assert if any stored metadata entry has an unresolvedID.IDobjects rather than string stand-ins.add_metadata()rejects duplicate registration for the sameIDobject.lvgl.final_validation()rejects a single LVGL instance configured with multiple displays whose metadata advertises differentbyte_ordervalues.byte_orderand no display metadata contributes an override, final validation defaults LVGL tobig_endian.Implementation guidance:
tests/component_tests/display/andtests/component_tests/lvgl/).ID-based metadata API change, update them as needed as part of the PR so the suite reflects the current behavior.Success criteria:
The following is the prior conversation context from the user's chat exploration (may be truncated):
User: Review the changes just pushed to branch lvgl-endian
Assistant: The latest push on
lvgl-endianlooks reviewable but not merge-ready as-is because the branch also contains a very large unrelated drift fromdev. The most recent commit itself is focused and reasonable; the branch overall is not.PR Summary
There doesn’t appear to be an open PR for
clydebarrow:lvgl-endian, so I reviewed the latest pushed commit plus the branch diff against the repo’s default branchdev.dev3edb476c2d6f3501ec34047b7c4aeae24f9de004[lvgl][mipi_spi][mipi_rgb][mipi_dsi] Metadata validationdev: high, because it includes a huge amount of unrelated changeCore Changes
The latest commit introduces a cleaner display metadata contract so LVGL can validate compatibility using metadata rather than peeking into raw display config structures.
What changed in the latest commit
displaymetadata expandedDisplayMetaDatanow includes:byte_orderrotationdraw_roundinghas_writerhas_hardware_rotationmipi_spi,mipi_rgb, andmipi_dsinow calldisplay.add_metadata(...)during schema/config processing rather than later codegen paths.byte_orderfrom attached displaysThis pull request was created from Copilot chat.