cleanup_unserializable results in weird handling of unserializable user_properties
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.
@nicoddemus i propose we switch to a own json encoder that replaces single broken objects with
{"$unserializable": str(x)}
@The-Compiler
the entire value gets turned into a string, rather than turning that specific property into one.
To be clear, would you expect this?
"user_properties": [
[
"hello",
"{'mars', 'world'}"
]
],
@RonnyPfannschmidt do you mean something like this?
"user_properties": [
[
"hello",
{"$unserializable": "{'mars', 'world'}"}
]
],
@nicoddemus see the draft mr
Ahh I see, so #35 will output:
"user_properties": [
[
"hello",
{"$no-json": "{'mars', 'world'}"}
]
],
What do you think @The-Compiler ?