@@ -315,9 +315,12 @@ def _should_report(self):
315
315
316
316
# we need to wrap pytest_runtestloop. by the time pytest_sessionfinish
317
317
# runs, it's too late to set testsfailed
318
- @pytest .hookimpl (hookwrapper = True )
318
+ @pytest .hookimpl (wrapper = True )
319
319
def pytest_runtestloop (self , session ):
320
- # override some warning configuration to prevent certain warnings to bubble up as errors due to rigid filterwarnings configuration
320
+ if self ._disabled :
321
+ return (yield )
322
+
323
+ # we add default warning configuration to prevent certain warnings to bubble up as errors due to rigid filterwarnings configuration
321
324
for _ , message , category , _ , _ in warnings .filters :
322
325
if category is ResourceWarning and message == COVERAGE_SQLITE_WARNING_RE :
323
326
break
@@ -334,10 +337,7 @@ def pytest_runtestloop(self, session):
334
337
else :
335
338
warnings .simplefilter ('once' , CoverageWarning )
336
339
337
- yield
338
-
339
- if self ._disabled :
340
- return
340
+ result = yield
341
341
342
342
compat_session = compat .SessionWrapper (session )
343
343
@@ -372,6 +372,8 @@ def pytest_runtestloop(self, session):
372
372
# make sure we get the EXIT_TESTSFAILED exit code
373
373
compat_session .testsfailed += 1
374
374
375
+ return result
376
+
375
377
def write_heading (self , terminalreporter ):
376
378
if not self ._wrote_heading :
377
379
terminalreporter .write_sep ('=' , 'tests coverage' )
0 commit comments