import datetime import pytest @pytest.hookimpl(tryfirst=True, hookwrapper=True) def pytest_runtest_makereport(item, call): outcome = yield rep = outcome.get_result() # if rep.when == "call": # @pytest.hookimpl(tryfirst=True) # def pytest_html_report_title(report): # """Set the title of the HTML report dynamically.""" # current_datetime = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S") # report.title = f"Test Report {current_datetime}"