-
-
Save maropu/16d415a1b9aa05b4d2f9b731a6435103 to your computer and use it in GitHub Desktop.
This file contains 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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment