Closed
Description
Is there a way to format the duration time to something like:
HH:MM:SS
or
h hours, m mins, s secs
I tried doing it within here, by changing the attribute value
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
outcome = yield
report = outcome.get_result()
report.description = str(item.function.__doc__)
# change duration format here
duration = getattr(report, "duration", 0.0)
converted_duration = timedelta(seconds=duration)
setattr(report, "duration", converted_duration)
However, plugin.py didn't like the format
INTERNALERROR> File python-virtual-environments/python3_env/lib/python3.6/site-packages/pytest_html/plugin.py", line 162, in __init__
INTERNALERROR> html.td(f"{self.time:.2f}", class_="col-duration"),
INTERNALERROR> TypeError: unsupported format string passed to datetime.timedelta.__format__