@@ -120,18 +120,22 @@ def accumulate_result(self, test, result):
120120 def display_progress (self , test_index , test ):
121121 if self .ns .quiet :
122122 return
123+
124+ # "[ 51/405/1] test_tcl passed"
125+ line = f"{ test_index :{self .test_count_width }} { self .test_count } "
123126 if self .bad and not self .ns .pgo :
124- fmt = "{time} [{test_index:{count_width}}{test_count}/{nbad}] {test_name}"
125- else :
126- fmt = "{time} [{test_index:{count_width}}{test_count}] {test_name}"
127+ line = f"{ line } /{ len (self .bad )} "
128+ line = f"[{ line } ] { test } "
129+
130+ # add the system load prefix: "load avg: 1.80 "
131+ if hasattr (os , 'getloadavg' ):
132+ load_avg_1min = os .getloadavg ()[0 ]
133+ line = f"load avg: { load_avg_1min :.2f} { line } "
134+
135+ # add the timestamp prefix: "0:01:05 "
127136 test_time = time .monotonic () - self .start_time
128137 test_time = datetime .timedelta (seconds = int (test_time ))
129- line = fmt .format (count_width = self .test_count_width ,
130- test_index = test_index ,
131- test_count = self .test_count ,
132- nbad = len (self .bad ),
133- test_name = test ,
134- time = test_time )
138+ line = f"{ test_time } { line } "
135139 print (line , flush = True )
136140
137141 def parse_args (self , kwargs ):
@@ -376,23 +380,28 @@ def _test_forever(self, tests):
376380 if self .bad :
377381 return
378382
383+ def display_header (self ):
384+ # Print basic platform information
385+ print ("==" , platform .python_implementation (), * sys .version .split ())
386+ print ("==" , platform .platform (aliased = True ),
387+ "%s-endian" % sys .byteorder )
388+ print ("== hash algorithm:" , sys .hash_info .algorithm ,
389+ "64bit" if sys .maxsize > 2 ** 32 else "32bit" )
390+ print ("== cwd:" , os .getcwd ())
391+ cpu_count = os .cpu_count ()
392+ if cpu_count :
393+ print ("== CPU count:" , cpu_count )
394+ print ("== encodings: locale=%s, FS=%s"
395+ % (locale .getpreferredencoding (False ),
396+ sys .getfilesystemencoding ()))
397+ print ("Testing with flags:" , sys .flags )
398+
379399 def run_tests (self ):
380400 # For a partial run, we do not need to clutter the output.
381- if (self .ns .verbose
382- or self .ns .header
383- or not (self .ns .pgo or self .ns .quiet or self .ns .single
384- or self .tests or self .ns .args )):
385- # Print basic platform information
386- print ("==" , platform .python_implementation (), * sys .version .split ())
387- print ("== " , platform .platform (aliased = True ),
388- "%s-endian" % sys .byteorder )
389- print ("== " , "hash algorithm:" , sys .hash_info .algorithm ,
390- "64bit" if sys .maxsize > 2 ** 32 else "32bit" )
391- print ("== cwd:" , os .getcwd ())
392- print ("== encodings: locale=%s, FS=%s"
393- % (locale .getpreferredencoding (False ),
394- sys .getfilesystemencoding ()))
395- print ("Testing with flags:" , sys .flags )
401+ if (self .ns .header
402+ or not (self .ns .pgo or self .ns .quiet or self .ns .single
403+ or self .tests or self .ns .args )):
404+ self .display_header ()
396405
397406 if self .ns .randomize :
398407 print ("Using random seed" , self .ns .random_seed )
0 commit comments