1111import os
1212import random
1313import re
14+ import textwrap
1415import urllib .parse
1516from collections .abc import Callable , Iterator
1617from contextlib import ExitStack
@@ -123,7 +124,7 @@ def pytest_addoption(parser: pytest.Parser) -> None:
123124
124125
125126# Dictionary to store start times of tests
126- _test_start_times = {}
127+ _test_start_times : dict [ str , datetime . datetime ] = {}
127128
128129
129130def pytest_runtest_setup (item ):
@@ -151,7 +152,7 @@ def _construct_graylog_url(
151152 return f"{ monitoring_url } /graylog/search?{ query } "
152153
153154
154- def pytest_runtest_makereport (item : Item , call ):
155+ def pytest_runtest_makereport (item : pytest . Item , call ):
155156 """
156157 Hook to add extra information when a test fails.
157158 """
@@ -178,12 +179,9 @@ def pytest_runtest_makereport(item: Item, call):
178179 )
179180 diagnostics ["duration" ] = str (end_time - start_time )
180181
181- # Print the diagnostics report
182- with log_context (
183- logging .WARNING ,
184- f"ℹ️ Diagnostics report for { test_name } ---" , # noqa: RUF001
185- ) as ctx :
186- ctx .logger .warning (json .dumps (diagnostics , indent = 2 ))
182+ print (f"\n Diagnostics report for { test_name } ---" ) # noqa: RUF001
183+ print (textwrap .indent (json .dumps (diagnostics , indent = 2 ), " " ))
184+ print ("---" )
187185
188186
189187@pytest .hookimpl (tryfirst = True )
0 commit comments