Created
November 14, 2017 20:13
-
-
Save okken/e0ec1d8f2020b1b49f688fb58416306b to your computer and use it in GitHub Desktop.
"fixes" duration reports in both PyCharm and pytest-html
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
# report call duration as both setup and call duration | |
# "fixes" duration reports in both PyCharm and pytest-html | |
_node_times = {} | |
@pytest.hookimpl(tryfirst=True) | |
def pytest_runtest_logreport(report): | |
if report.when == 'setup': | |
_node_times[report.nodeid] = report.duration | |
if report.when == 'call': | |
report.duration = report.duration + _node_times[report.nodeid] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment