pytest-dev / pytest-dev/pytest-reportlog
cleanup_unserializable results in weird handling of unserializable user_properties
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 104
- Forks
- 23
- PR merge metrics
- No merged PRs in 30d
Description
This file:
def test_user_properties_list(record_property):
record_property("hello", ["world", "mars"])
def test_user_properties_set(record_property):
record_property("hello", {"world", "mars"})
results in the following reports (pretty printed for readability):
{
"nodeid": "test_replog.py::test_user_properties_list",
"location": [
"test_replog.py",
0,
"test_user_properties_list"
],
"keywords": {
"test_replog.py": 1,
"test_user_properties_list": 1,
"autpy": 1
},
"outcome": "passed",
"longrepr": null,
"when": "call",
"user_properties": [
[
"hello",
[
"world",
"mars"
]
]
],
"sections": [],
"duration": 8.534699736628681e-05,
"$report_type": "TestReport"
}
{
"nodeid": "test_replog.py::test_user_properties_set",
"location": [
"test_replog.py",
3,
"test_user_properties_set"
],
"keywords": {
"test_replog.py": 1,
"test_user_properties_set": 1,
"autpy": 1
},
"outcome": "passed",
"longrepr": null,
"when": "call",
"user_properties": "[('hello', {'mars', 'world'})]",
"sections": [],
"duration": 0.00017495399515610188,
"$report_type": "TestReport"
}
Note the different storage of user_properties:
"user_properties": [
[
"hello",
[
"world",
"mars"
]
]
],
"user_properties": "[('hello', {'mars', 'world'})]",
i.e. if an user property value is unserializable, the entire value gets turned into a string, rather than turning that specific property into one.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the behavior from the test_user_properties_list and test_user_properties_set examples in test_replog.py, then inspect cleanup_unserializable. The fix is complete when an unserializable value is handled independently without converting the entire user_properties collection to a string, with tests covering both examples.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100