Last active
January 26, 2021 23:43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@pytest.hookimpl(hookwrapper=True) | |
def pytest_report_teststatus(report, config): | |
outcome = yield | |
res = outcome.get_result() | |
attr_name = "___TIME___" | |
if report.when == "setup": | |
# HACK: store the start time in `config` | |
setattr(config, attr_name, time.time()) | |
elif report.when == "call": | |
start = getattr(config, attr_name) | |
new_res = res[:2] + (res[2] + " ({:.3f} s)".format(time.time() - start),) | |
outcome.force_result(new_res) |
Author
harupy
commented
Nov 28, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment