|
Hi, is this correct approach for creating a summary or is there a simpler api? Thanks in advance… |
Replies: 1 comment 1 reply
|
Hi @amolgawai Use the report's pytest creates separate reports for setup, the actual test call, and teardown. A normal assertion/test failure is generally: report.when == "call" and report.failedwhile what pytest displays as an ERROR is normally a setup or teardown failure. For example: def pytest_runtest_logreport(report):
if report.when == "call":
if report.passed:
passed += 1
elif report.failed:
failed += 1
elif report.skipped:
skipped += 1
elif report.when in ("setup", "teardown") and report.failed:
errors += 1The important part is to count normal test outcomes only for
Please mark this answer as accepted if it helped, thank you. |
Hi @amolgawai
Use the report's
whenvalue in addition topassed/failed.pytest creates separate reports for setup, the actual test call, and teardown. A normal assertion/test failure is generally:
while what pytest displays as an ERROR is normally a setup or teardown failure.
For example:
The important part is to count normal test outcomes onl…