pytest_runtest_makereport () receives two arguments, an element and a call. From the element, I can find the funcarg that I created for this test, and from the call, I can find the exception information (if any):
def pytest_runtest_makereport (item, call): my_funcarg = item.funcargs['name'] my_funcarg.excinfo = call.excinfo
Unfortunately, excinfo is populated for both failures and passes. To distinguish, I need to look at the report argument at pytest_report_teststatus ():
def pytest_report_teststatus (report): if report.when == 'call': if report.failed: failed = True elif report.skipped: skipped = True else: passed = True
This is great information, but I can't match it with the funcarg I created for the test. I looked at the report argument (TestReport report) and I cannot find a way to return to the element passed to pytest_runtest_makereport () or the funcarg I created.
Where can I access both?
source share