File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed 
Misc/NEWS.d/next/Tools-Demos Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change 1+ The iOS test runner now strips the log prefix from each line output by the
2+ test suite.
Original file line number Diff line number Diff line change 22import  asyncio 
33import  json 
44import  plistlib 
5+ import  re 
56import  shutil 
67import  subprocess 
78import  sys 
1213
1314DECODE_ARGS  =  ("UTF-8" , "backslashreplace" )
1415
16+ # The system log prefixes each line: 
17+ #   2025-01-17 16:14:29.090 Df iOSTestbed[23987:1fd393b4] (Python) ... 
18+ #   2025-01-17 16:14:29.090 E  iOSTestbed[23987:1fd393b4] (Python) ... 
19+ 
20+ LOG_PREFIX_REGEX  =  re .compile (
21+     r"^\d{4}-\d{2}-\d{2}"   # YYYY-MM-DD 
22+     r"\s+\d+:\d{2}:\d{2}\.\d+"   # HH:MM:SS.sss 
23+     r"\s+\w+"   # Df/E 
24+     r"\s+iOSTestbed\[\d+:\w+\]"   # Process/thread ID 
25+     r"\s+\(Python\)\s"   # Logger name 
26+ )
27+ 
1528
1629# Work around a bug involving sys.exit and TaskGroups 
1730# (https://github.com/python/cpython/issues/101515). 
@@ -131,6 +144,8 @@ async def log_stream_task(initial_devices):
131144    ) as  process :
132145        suppress_dupes  =  False 
133146        while  line  :=  (await  process .stdout .readline ()).decode (* DECODE_ARGS ):
147+             # Strip the prefix from each log line 
148+             line  =  LOG_PREFIX_REGEX .sub ("" , line )
134149            # The iOS log streamer can sometimes lag; when it does, it outputs 
135150            # a warning about messages being dropped... often multiple times. 
136151            # Only print the first of these duplicated warnings. 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments