@@ -184,6 +184,12 @@ def pytest_runtest_protocol(item):
184
184
if is_timeout and settings .func_only is False :
185
185
hooks .pytest_timeout_cancel_timer (item = item )
186
186
187
+ # check suite timeout
188
+ expire_time = item .session .config .stash [SUITE_TIMEOUT_KEY ]
189
+ if expire_time and (expire_time < time .time ()):
190
+ timeout = item .session .config .getoption ("--suite-timeout" )
191
+ item .session .shouldfail = f"suite-timeout: { timeout } sec exceeded"
192
+
187
193
188
194
@pytest .hookimpl (hookwrapper = True )
189
195
def pytest_runtest_call (item ):
@@ -538,15 +544,3 @@ def dump_stacks(terminal):
538
544
thread_name = "<unknown>"
539
545
terminal .sep ("~" , title = "Stack of %s (%s)" % (thread_name , thread_ident ))
540
546
terminal .write ("" .join (traceback .format_stack (frame )))
541
-
542
-
543
- @pytest .hookimpl (tryfirst = True )
544
- def pytest_runtest_makereport (item , call ):
545
- # only need to check timeout once, at the end, after teardown
546
- if call .when == "teardown" :
547
- session = item .session
548
- config = session .config
549
- expire_time = config .stash [SUITE_TIMEOUT_KEY ]
550
- if expire_time and (expire_time < time .time ()):
551
- timeout = config .getoption ("--suite-timeout" )
552
- session .shouldfail = f"suite-timeout: { timeout } sec exceeded"
0 commit comments