Repository navigation
fix(report): report_generator handles dict-shaped user_properties - #183
Merged
Merged
Conversation
pytest-json-report writes record_property entries as {name: value}; only
conftest's injected [name, value] screenshot pairs unpacked, so any test
recording a property crashed the PDF step.
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.
Fixes #149
Cause
pytest-json-report 1.5.0 serializes
report.user_propertiesas one-key dicts (plugin.py:189:[{str(key): val} for key, val in report.user_properties]).report_generator.pyunpacked every entry as a(name, value)pair. Onlyconftest.py's injected["screenshot", path]entries have that shape, so any test that recorded a property crashed the PDF step afterTEST_REPORT.mdwas written.Fix
Accept both shapes, and a
nulluser_properties.report_generator.pyis the only reader ofuser_propertiesin the repo, including workflows.Verified
Using a real
report.jsonfrom a throwaway failing test that callsrecord_property("dataset_id", "abc123"):report_generator.pyTEST_REPORT.mdgenerated, thenValueError: not enough values to unpack (expected 2, got 1); no PDFTEST_REPORT.mdandTEST_REPORT.pdfgenerated["screenshot", …]pair