summaryrefslogtreecommitdiffstats
path: root/Lib/test/pythoninfo.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-09-12 16:43:32 (GMT)
committerGitHub <noreply@github.com>2023-09-12 16:43:32 (GMT)
commitd12b3e3152b1858e91c4890d0bf3a3b574a3ff6f (patch)
tree494ab2bb82c7d0eb24017405c0e5a24057c349e3 /Lib/test/pythoninfo.py
parentb303d3ad3e80e1d9b3befe6650f61f38b72179a4 (diff)
downloadcpython-d12b3e3152b1858e91c4890d0bf3a3b574a3ff6f.zip
cpython-d12b3e3152b1858e91c4890d0bf3a3b574a3ff6f.tar.gz
cpython-d12b3e3152b1858e91c4890d0bf3a3b574a3ff6f.tar.bz2
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
Diffstat (limited to 'Lib/test/pythoninfo.py')
-rw-r--r--Lib/test/pythoninfo.py77
1 files changed, 68 insertions, 9 deletions
diff --git a/Lib/test/pythoninfo.py b/Lib/test/pythoninfo.py
index e52fa6b..ea3a78a 100644
--- a/Lib/test/pythoninfo.py
+++ b/Lib/test/pythoninfo.py
@@ -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)