33
33
EXIT_TIMEOUT = 120.0
34
34
35
35
36
+ ALL_RESOURCES = ('audio' , 'curses' , 'largefile' , 'network' ,
37
+ 'decimal' , 'cpu' , 'subprocess' , 'urlfetch' , 'gui' , 'walltime' )
38
+
39
+ # Other resources excluded from --use=all:
40
+ #
41
+ # - extralagefile (ex: test_zipfile64): really too slow to be enabled
42
+ # "by default"
43
+ # - tzdata: while needed to validate fully test_datetime, it makes
44
+ # test_datetime too slow (15-20 min on some buildbots) and so is disabled by
45
+ # default (see bpo-30822).
46
+ RESOURCE_NAMES = ALL_RESOURCES + ('extralargefile' , 'tzdata' )
47
+
48
+
36
49
# Types for types hints
37
50
StrPath = str
38
51
TestName = str
@@ -535,6 +548,25 @@ def is_cross_compiled():
535
548
return ('_PYTHON_HOST_PLATFORM' in os .environ )
536
549
537
550
551
+ def format_resources (use_resources : tuple [str , ...]):
552
+ # Express resources related to "all"
553
+ all_minus = [name for name in ALL_RESOURCES
554
+ if name not in use_resources ]
555
+ all_minus .insert (0 , 'all' )
556
+ all_minus = ',-' .join (all_minus )
557
+ all_add = [name for name in use_resources
558
+ if name not in ALL_RESOURCES ]
559
+ all_add .insert (0 , all_minus )
560
+ all_add = ',' .join (all_add )
561
+ all_text = f"resources: { all_add } "
562
+
563
+ text = ', ' .join (sorted (use_resources ))
564
+ text = f"resources ({ len (use_resources )} ): { text } "
565
+ if len (all_text ) <= len (text ):
566
+ text = all_text
567
+ return text
568
+
569
+
538
570
def display_header (use_resources : tuple [str , ...],
539
571
python_cmd : tuple [str , ...] | None ):
540
572
# Print basic platform information
@@ -550,14 +582,15 @@ def display_header(use_resources: tuple[str, ...],
550
582
if process_cpu_count and process_cpu_count != cpu_count :
551
583
cpu_count = f"{ process_cpu_count } (process) / { cpu_count } (system)"
552
584
print ("== CPU count:" , cpu_count )
553
- print ("== encodings: locale=%s, FS=%s"
585
+ print ("== encodings: locale=%s FS=%s"
554
586
% (locale .getencoding (), sys .getfilesystemencoding ()))
555
587
556
588
if use_resources :
557
- print ( f"== resources ( { len ( use_resources )} ): "
558
- f" { ', ' . join ( sorted ( use_resources )) } " )
589
+ text = format_resources ( use_resources )
590
+ print ( f"== { text } " )
559
591
else :
560
- print ("== resources: (all disabled, use -u option)" )
592
+ print ("== resources: all test resources are disabled, "
593
+ "use -u option to unskip tests" )
561
594
562
595
cross_compile = is_cross_compiled ()
563
596
if cross_compile :
0 commit comments