File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -814,15 +814,12 @@ def test_frozen_module_from_import_error(self):
814814            f"cannot import name 'this_will_never_exist' from 'os' ({ os .__file__ }  ,
815815            str (cm .exception ),
816816        )
817- 
818-         expected_error  =  (
819-             b"cannot import name 'this_will_never_exist' " 
820-             b"from 'sys' (unknown location)" 
817+         with  self .assertRaises (ImportError ) as  cm :
818+             from  sys  import  this_will_never_exist 
819+         self .assertIn (
820+             "cannot import name 'this_will_never_exist' from 'sys' (unknown location)" ,
821+             str (cm .exception ),
821822        )
822-         popen  =  script_helper .spawn_python ("-c" , "from sys import this_will_never_exist" )
823-         stdout , stderr  =  popen .communicate ()
824-         self .assertIn (expected_error , stdout )
825- 
826823
827824        scripts  =  [
828825            """ 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments