File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change 1212
1313
1414class  HashLibFIPSTestCase (unittest .TestCase ):
15+     _executions  =  0   # prevent re-running on in refleak hunting mode, etc. 
16+ 
1517    @classmethod  
1618    def  setUpClass (cls ):
19+         if  cls ._executions  >  0 :
20+             raise  unittest .SkipTest ("Cannot run this test within the same Python process." )
1721        if  sys .modules .get ("_hashlib" ) or  sys .modules .get ("_ssl" ):
1822            raise  AssertionError ("_hashlib or _ssl already imported, too late to change OPENSSL_CONF." )
1923        # This openssl.cnf mocks FIPS mode without any digest 
@@ -43,6 +47,7 @@ def tearDownClass(cls):
4347            os .environ ["OPENSSL_CONF" ] =  OPENSSL_CONF_BACKUP 
4448        else :
4549            os .environ .pop ("OPENSSL_CONF" , None )
50+         cls ._executions  +=  1 
4651
4752    def  test_algorithms_available (self ):
4853        import  hashlib 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments