Skip to content

cleanup_unserializable results in weird handling of unserializable user_properties #12

Description

@The-Compiler

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions