File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -157,9 +157,11 @@ def pytest_runtest_protocol(item):
157
157
is_timeout = settings .timeout is not None and settings .timeout > 0
158
158
if is_timeout and settings .func_only is False :
159
159
hooks .pytest_timeout_set_timer (item = item , settings = settings )
160
- yield
161
- if is_timeout and settings .func_only is False :
162
- hooks .pytest_timeout_cancel_timer (item = item )
160
+ try :
161
+ yield
162
+ finally :
163
+ if is_timeout and settings .func_only is False :
164
+ hooks .pytest_timeout_cancel_timer (item = item )
163
165
164
166
165
167
@pytest .hookimpl (hookwrapper = True )
@@ -174,9 +176,11 @@ def pytest_runtest_call(item):
174
176
is_timeout = settings .timeout is not None and settings .timeout > 0
175
177
if is_timeout and settings .func_only is True :
176
178
hooks .pytest_timeout_set_timer (item = item , settings = settings )
177
- yield
178
- if is_timeout and settings .func_only is True :
179
- hooks .pytest_timeout_cancel_timer (item = item )
179
+ try :
180
+ yield
181
+ finally :
182
+ if is_timeout and settings .func_only is True :
183
+ hooks .pytest_timeout_cancel_timer (item = item )
180
184
181
185
182
186
@pytest .hookimpl (tryfirst = True )
You can’t perform that action at this time.
0 commit comments