useblocks / sphinx-test-reports

Documents test-results inside Sphinx
https://sphinx-test-reports.readthedocs.io/en/latest/
MIT License
29 stars 21 forks source link

tr_rootdir being a Path obj causes esbonio v0.92.1 (pre-release) to crash #74

Open iaavo opened 7 months ago

iaavo commented 7 months ago

tr_rootdir being a Path obj causes esbonio v0.92.1 (pre-release) to crash

test_reports.py#L47:

app.add_config_value("tr_rootdir", app.confdir, "html")

since app.confdir is a Path, it causes esbonio to raise an exception as it cant convert the configuration to a json

util.py#L27:

def as_json(data: Any) -> str:
    if dataclasses.is_dataclass(data):
        data = dataclasses.asdict(data)

    return json.dumps(data, default=_serialize_message)

one way to fix this issue would be:

app.add_config_value("tr_rootdir", str(app.confdir), "html")
chrisjsewell commented 7 months ago

since app.confdir is a Path

Thanks for the report, just to note, this is a change in Sphinx core, since 7.2.6 if I recall correctly

danwos commented 7 months ago

I'm afraid this needs to be fixed by Esbonio, as Sphinx-Test-Reports is using the official Sphinx API correctly: https://www.sphinx-doc.org/en/master/extdev/appapi.html#sphinx.application.Sphinx.add_config_value

There may be also a workaround on project/user side, as the default value app.confdir is just the default, meaning settingtr_rootdir in conf.py should fix it. Can you try this and and give a short feedback?