mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
gh-109276: regrtest: shorter list of resources (#110326)
This commit is contained in:
parent
1337765225
commit
efd8c7a7c9
3 changed files with 63 additions and 17 deletions
|
@ -33,6 +33,19 @@ WORKER_WORK_DIR_PREFIX = WORK_DIR_PREFIX + 'worker_'
|
|||
EXIT_TIMEOUT = 120.0
|
||||
|
||||
|
||||
ALL_RESOURCES = ('audio', 'curses', 'largefile', 'network',
|
||||
'decimal', 'cpu', 'subprocess', 'urlfetch', 'gui', 'walltime')
|
||||
|
||||
# Other resources excluded from --use=all:
|
||||
#
|
||||
# - extralagefile (ex: test_zipfile64): really too slow to be enabled
|
||||
# "by default"
|
||||
# - tzdata: while needed to validate fully test_datetime, it makes
|
||||
# test_datetime too slow (15-20 min on some buildbots) and so is disabled by
|
||||
# default (see bpo-30822).
|
||||
RESOURCE_NAMES = ALL_RESOURCES + ('extralargefile', 'tzdata')
|
||||
|
||||
|
||||
# Types for types hints
|
||||
StrPath = str
|
||||
TestName = str
|
||||
|
@ -535,6 +548,30 @@ def is_cross_compiled():
|
|||
return ('_PYTHON_HOST_PLATFORM' in os.environ)
|
||||
|
||||
|
||||
def format_resources(use_resources: tuple[str, ...]):
|
||||
use_resources = set(use_resources)
|
||||
all_resources = set(ALL_RESOURCES)
|
||||
|
||||
# Express resources relative to "all"
|
||||
relative_all = ['all']
|
||||
for name in sorted(all_resources - use_resources):
|
||||
relative_all.append(f'-{name}')
|
||||
for name in sorted(use_resources - all_resources):
|
||||
relative_all.append(f'{name}')
|
||||
all_text = ','.join(relative_all)
|
||||
all_text = f"resources: {all_text}"
|
||||
|
||||
# List of enabled resources
|
||||
text = ','.join(sorted(use_resources))
|
||||
text = f"resources ({len(use_resources)}): {text}"
|
||||
|
||||
# Pick the shortest string (prefer relative to all if lengths are equal)
|
||||
if len(all_text) <= len(text):
|
||||
return all_text
|
||||
else:
|
||||
return text
|
||||
|
||||
|
||||
def display_header(use_resources: tuple[str, ...],
|
||||
python_cmd: tuple[str, ...] | None):
|
||||
# Print basic platform information
|
||||
|
@ -550,14 +587,15 @@ def display_header(use_resources: tuple[str, ...],
|
|||
if process_cpu_count and process_cpu_count != cpu_count:
|
||||
cpu_count = f"{process_cpu_count} (process) / {cpu_count} (system)"
|
||||
print("== CPU count:", cpu_count)
|
||||
print("== encodings: locale=%s, FS=%s"
|
||||
print("== encodings: locale=%s FS=%s"
|
||||
% (locale.getencoding(), sys.getfilesystemencoding()))
|
||||
|
||||
if use_resources:
|
||||
print(f"== resources ({len(use_resources)}): "
|
||||
f"{', '.join(sorted(use_resources))}")
|
||||
text = format_resources(use_resources)
|
||||
print(f"== {text}")
|
||||
else:
|
||||
print("== resources: (all disabled, use -u option)")
|
||||
print("== resources: all test resources are disabled, "
|
||||
"use -u option to unskip tests")
|
||||
|
||||
cross_compile = is_cross_compiled()
|
||||
if cross_compile:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue