Skip to content

Set DucktapeJSONEncoder as default in reports generator. #250

@ivandasch

Description

@ivandasch

Currently, there is inconsistency with json encoder in tests/reporter.py. Some methods use it, some uses default.
I.e. JSONReporter use DucktapeJSONEncoder, but other encoders not.

Lets introduce some alias to json.dumps i.e.

def json_dumps(obj, **kwargs):
    """
    Dump object to json string with Ducktape json encoder.
    """
    assert 'cls' not in kwargs, "Passing custom json encoder is forbidden."

    return json.dumps(obj, cls=DucktapeJSONEncoder, **kwargs)

and use it everywhere in tests/reporter.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions