Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set DucktapeJSONEncoder as default in reports generator. #250

Open
ivandasch opened this issue Sep 7, 2020 · 1 comment · May be fixed by #251
Open

Set DucktapeJSONEncoder as default in reports generator. #250

ivandasch opened this issue Sep 7, 2020 · 1 comment · May be fixed by #251

Comments

@ivandasch
Copy link
Contributor

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

@ivandasch
Copy link
Contributor Author

@ewencp Hi, could you please review this small patch?

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 a pull request may close this issue.

1 participant