10000 gh-109276: test.pythoninfo gets more test.support data (#109337) · python/cpython@d12b3e3 · GitHub
[go: up one dir, main page]

Skip to content

Commit d12b3e3

Browse files
authored
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
1 parent b303d3a commit d12b3e3

File tree

1 file changed

+68
-9
lines changed

1 file changed

+68
-9
lines changed

Lib/test/pythoninfo.py

Lines changed: 68 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -717,26 +717,82 @@ def collect_test_socket(info_add):
717717
copy_attributes(info_add, test_socket, 'test_socket.%s', attributes)
718718

719719

720-
def collect_test_support(info_add):
720+
def collect_support(info_add):
721721
try:
722722
from test import support
723723
except ImportError:
724724
return
725725

726-
attributes = ('IPV6_ENABLED',)
727-
copy_attributes(info_add, support, 'test_support.%s', attributes)
726+
attributes = (
727+
'has_fork_support',
728+
'has_socket_support',
729+
'has_strftime_extensions',
730+
'has_subprocess_support',
731+
'is_android',
732+
'is_emscripten',
733+
'is_jython',
734+
'is_wasi',
735+
)
736+
copy_attributes(info_add, support, 'support.%s', attributes)
728737

729-
call_func(info_add, 'test_support._is_gui_available', support, '_is_gui_available')
730-
call_func(info_add, 'test_support.python_is_optimized', support, 'python_is_optimized')
738+
call_func(info_add, 'support._is_gui_available', support, '_is_gui_available')
739+
call_func(info_add, 'support.python_is_optimized', support, 'python_is_optimized')
731740

732-
info_add('test_support.check_sanitizer(address=True)',
741+
info_add('support.check_sanitizer(address=True)',
733742
support.check_sanitizer(address=True))
734-
info_add('test_support.check_sanitizer(memory=True)',
743+
info_add('support.check_sanitizer(memory=True)',
735744
support.check_sanitizer(memory=True))
736-
info_add('test_support.check_sanitizer(ub=True)',
745+
info_add('support.check_sanitizer(ub=True)',
737746
support.check_sanitizer(ub=True))
738747

739748

749+
def collect_support_os_helper(info_add):
750+
try:
751+
from test.support import os_helper
752+
except ImportError:
753+
return
754+
755+
for name in (
756+
'can_symlink',
757+
'can_xattr',
758+
'can_chmod',
759+
'can_dac_override',
760+
):
761+
func = getattr(os_helper, name)
762+
info_add(f'support_os_helper.{name}', func())
763+
764+
765+
def collect_support_socket_helper(info_add):
766+
try:
767+
from test.support import socket_helper
768+
except ImportError:
769+
return
770+
771+
attributes = (
772+
'IPV6_ENABLED',
773+
'has_gethostname',
774+
)
775+
copy_attributes(info_add, socket_helper, 'support_socket_helper.%s', attributes)
776+
777+
for name in (
778+
'tcp_blackhole',
779+
):
780+
func = getattr(socket_helper, name)
781+
info_add(f'support_socket_helper.{name}', func())
782+
783+
784+
def collect_support_threading_helper(info_add):
785+
try:
786+
from test.support import threading_helper
787+
except ImportError:
788+
return
789+
790+
attributes = (
791+
'can_start_thread',
792+
)
793+
copy_attributes(info_add, threading_helper, 'support_threading_helper.%s', attributes)
794+
795+
740796
def collect_cc(info_add):
741797
import subprocess
742798
import sysconfig
@@ -938,7 +994,10 @@ def collect_info(info):
938994

939995
# Collecting from tests should be last as they have side effects.
940996
collect_test_socket,
941-
collect_test_support,
997+
collect_support,
998+
collect_support_os_helper,
999+
collect_support_socket_helper,
1000+
collect_support_threading_helper,
9421001
):
9431002
try:
9441003
collect_func(info_add)

0 commit comments

Comments
 (0)
0