File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change 99
1010import  coverage 
1111import  pytest 
12+ from  coverage .exceptions  import  CoverageWarning 
1213from  coverage .results  import  display_covered 
1314from  coverage .results  import  should_fail_under 
1415
1516from  . import  CovDisabledWarning 
1617from  . import  CovReportWarning 
18+ from  . import  PytestCovWarning 
1719from  . import  compat 
1820from  . import  embed 
1921
@@ -312,6 +314,11 @@ def _should_report(self):
312314    # runs, it's too late to set testsfailed 
313315    @pytest .hookimpl (hookwrapper = True ) 
314316    def  pytest_runtestloop (self , session ):
317+         # override some warning configuration to prevent certain warnings to bubble up as errors due to rigid filterwarnings configuration 
318+         warnings .filterwarnings ('default' , 'unclosed database in <sqlite3.Connection object at' , ResourceWarning )
319+         warnings .simplefilter ('once' , PytestCovWarning )
320+         warnings .simplefilter ('once' , CoverageWarning )
321+ 
315322        yield 
316323
317324        if  self ._disabled :
Original file line number Diff line number Diff line change @@ -1348,8 +1348,6 @@ def test_filterwarnings_error(testdir):
13481348    [pytest] 
13491349    filterwarnings = 
13501350        error 
1351-         once::coverage.exceptions.CoverageWarning 
1352-         once::pytest_cov.PytestCovWarning 
13531351    """ )
13541352    testdir .makepyfile (mod = MODULE )
13551353    testdir .makepyfile (plug = CONFTEST )
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments