mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	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:
		
							parent
							
								
									b303d3ad3e
								
							
						
					
					
						commit
						d12b3e3152
					
				
					 1 changed files with 68 additions and 9 deletions
				
			
		|  | @ -717,26 +717,82 @@ def collect_test_socket(info_add): | ||||||
|     copy_attributes(info_add, test_socket, 'test_socket.%s', attributes) |     copy_attributes(info_add, test_socket, 'test_socket.%s', attributes) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def collect_test_support(info_add): | def collect_support(info_add): | ||||||
|     try: |     try: | ||||||
|         from test import support |         from test import support | ||||||
|     except ImportError: |     except ImportError: | ||||||
|         return |         return | ||||||
| 
 | 
 | ||||||
|     attributes = ('IPV6_ENABLED',) |     attributes = ( | ||||||
|     copy_attributes(info_add, support, 'test_support.%s', 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, '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.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)) |              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)) |              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)) |              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): | def collect_cc(info_add): | ||||||
|     import subprocess |     import subprocess | ||||||
|     import sysconfig |     import sysconfig | ||||||
|  | @ -938,7 +994,10 @@ def collect_info(info): | ||||||
| 
 | 
 | ||||||
|         # Collecting from tests should be last as they have side effects. |         # Collecting from tests should be last as they have side effects. | ||||||
|         collect_test_socket, |         collect_test_socket, | ||||||
|         collect_test_support, |         collect_support, | ||||||
|  |         collect_support_os_helper, | ||||||
|  |         collect_support_socket_helper, | ||||||
|  |         collect_support_threading_helper, | ||||||
|     ): |     ): | ||||||
|         try: |         try: | ||||||
|             collect_func(info_add) |             collect_func(info_add) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Victor Stinner
						Victor Stinner