Skip to content

Instantly share code, notes, and snippets.

@okken
Created November 14, 2017 20:13
Show Gist options
  • Save okken/e0ec1d8f2020b1b49f688fb58416306b to your computer and use it in GitHub Desktop.
Save okken/e0ec1d8f2020b1b49f688fb58416306b to your computer and use it in GitHub Desktop.
"fixes" duration reports in both PyCharm and pytest-html
# 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