Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 68 additions & 9 deletions Lib/test/pythoninfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down