File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -53,11 +53,16 @@ def pytest_sessionfinish(session: pytest.Session) -> None:
5353    # copy all pytest own logs inside $VIRTUAL_ENV/log, for collection. 
5454    venv  =  os .environ .get ("VIRTUAL_ENV" , "" )
5555    if  os .environ .get ("CI" , "0" ) !=  "0"  and  venv :
56-         shutil .copytree (
57-             src = session .config ._tmp_path_factory .getbasetemp (),  # type: ignore[attr-defined] # noqa: SLF001 
58-             dst = venv  +  "/log" ,
59-             dirs_exist_ok = True ,
60-         )
56+         # Copy can fail if the source folder was already removed, but we 
57+         # should not fail due to this. 
58+         try :
59+             shutil .copytree (
60+                 src = session .config ._tmp_path_factory .getbasetemp (),  # type: ignore[attr-defined] # noqa: SLF001 
61+                 dst = venv  +  "/log" ,
62+                 dirs_exist_ok = True ,
63+             )
64+         except  OSError  as  e :
65+             _logger .warning ("Failed to copy pytest logs to $VIRTUAL_ENV/log: %s" , e )
6166
6267
6368@pytest .hookimpl (tryfirst = True )  # type: ignore[misc,unused-ignore]  
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments