Generate partial HTML report on abort
We are running into a situation with the combination of pytest-repeat and pytest-html where we repeat a test n times yet if aborted (for example by Jenkins) no HTML report is generated. This occurs even if n - 1 iterations ran successfully and pytest execution was only aborted during the last iteration. I welcome any suggestions/solutions that I can implement myself (for example in conftest.py).
This is going to be solved by next-gen, as the report is updated per test.
Great, thanks @BeyondEvil!
2 follow-up questions:
- Is there a target date for next-gen?
- In the meantime as a temporary solution would there be any downsides to doing something like this (code snippet quoted below)?
@pytest.fixture(scope='function', autouse=True)
def test_blackbox(request):
session = request.node
html = request.config._html
report_content = html._generate_report(session)
html._save_report(report_content)
Great, thanks @BeyondEvil!
2 follow-up questions:
- Is there a target date for next-gen?
- In the meantime as a temporary solution would there be any downsides to doing something like this (code snippet quoted below)?
@pytest.fixture(scope='function', autouse=True) def test_blackbox(request): session = request.node html = request.config._html report_content = html._generate_report(session) html._save_report(report_content)
No target-date, sorry.
I'm sure there are downsides, the question is how relevant they are.
For one, this isn't being called: https://github.com/pytest-dev/pytest-html/blob/360f1204678e1e837cb2bcc8e27f7adb5db6a2e0/src/pytest_html/html_report.py#L270
You may also get issue when trying to overwrite an existing report.