Skip to content

fix(report): report_generator handles dict-shaped user_properties - #183

Merged
saqibmanan merged 1 commit into
CIfrom
fix-report-user-properties
Oct 7, 2026
Merged

saqibmanan merged 1 commit into
CIfrom
fix-report-user-properties

Conversation

@saqibmanan

Copy link
Copy Markdown
Contributor

Fixes #149

Cause

pytest-json-report 1.5.0 serializes report.user_properties as one-key dicts (plugin.py:189: [{str(key): val} for key, val in report.user_properties]). report_generator.py unpacked every entry as a (name, value) pair. Only conftest.py's injected ["screenshot", path] entries have that shape, so any test that recorded a property crashed the PDF step after TEST_REPORT.md was written.

Fix

Accept both shapes, and a null user_properties. report_generator.py is the only reader of user_properties in the repo, including workflows.

Verified

Using a real report.json from a throwaway failing test that calls record_property("dataset_id", "abc123"):

result
old report_generator.py TEST_REPORT.md generated, then ValueError: not enough values to unpack (expected 2, got 1); no PDF
new TEST_REPORT.md and TEST_REPORT.pdf generated
new, with a dict entry plus an injected ["screenshot", …] pair both generated, and the screenshot entry is still found

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.
@saqibmanan
saqibmanan merged commit 7424f8d into CI Oct 7, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant