gh-109276: test.pythoninfo gets more test.support data (#109337)

Collect data from:

* test.support
* test.support.os_helper
* test.support.socket_helper
* test.support.threading_helper
This commit is contained in:
Victor Stinner 2023-09-12 18:43:32 +02:00 committed by GitHub
parent b303d3ad3e
commit d12b3e3152
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -717,26 +717,82 @@ def collect_test_socket(info_add):
copy_attributes(info_add, test_socket, 'test_socket.%s', attributes)
def collect_test_support(info_add):
def collect_support(info_add):
try:
from test import support
except ImportError:
return
attributes = ('IPV6_ENABLED',)
copy_attributes(info_add, support, 'test_support.%s', attributes)
attributes = (
'has_fork_support',
'has_socket_support',
'has_strftime_extensions',
'has_subprocess_support',
'is_android',
'is_emscripten',
'is_jython',
'is_wasi',
)
copy_attributes(info_add, support, 'support.%s', attributes)
call_func(info_add, 'test_support._is_gui_available', support, '_is_gui_available')
call_func(info_add, 'test_support.python_is_optimized', support, 'python_is_optimized')
call_func(info_add, 'support._is_gui_available', support, '_is_gui_available')
call_func(info_add, 'support.python_is_optimized', support, 'python_is_optimized')
info_add('test_support.check_sanitizer(address=True)',
info_add('support.check_sanitizer(address=True)',
support.check_sanitizer(address=True))
info_add('test_support.check_sanitizer(memory=True)',
info_add('support.check_sanitizer(memory=True)',
support.check_sanitizer(memory=True))
info_add('test_support.check_sanitizer(ub=True)',
info_add('support.check_sanitizer(ub=True)',
support.check_sanitizer(ub=True))
def collect_support_os_helper(info_add):
try:
from test.support import os_helper
except ImportError:
return
for name in (
'can_symlink',
'can_xattr',
'can_chmod',
'can_dac_override',
):
func = getattr(os_helper, name)
info_add(f'support_os_helper.{name}', func())
def collect_support_socket_helper(info_add):
try:
from test.support import socket_helper
except ImportError:
return
attributes = (
'IPV6_ENABLED',
'has_gethostname',
)
copy_attributes(info_add, socket_helper, 'support_socket_helper.%s', attributes)
for name in (
'tcp_blackhole',
):
func = getattr(socket_helper, name)
info_add(f'support_socket_helper.{name}', func())
def collect_support_threading_helper(info_add):
try:
from test.support import threading_helper
except ImportError:
return
attributes = (
'can_start_thread',
)
copy_attributes(info_add, threading_helper, 'support_threading_helper.%s', attributes)
def collect_cc(info_add):
import subprocess
import sysconfig
@ -938,7 +994,10 @@ def collect_info(info):
# Collecting from tests should be last as they have side effects.
collect_test_socket,
collect_test_support,
collect_support,
collect_support_os_helper,
collect_support_socket_helper,
collect_support_threading_helper,
):
try:
collect_func(info_add)