11"""
22Collect various information about Python to help debugging test failures.
33"""
4- from __future__ import print_function
54import errno
65import re
76import sys
87import traceback
9- import unittest
108import warnings
119
1210
13- MS_WINDOWS = (sys .platform == 'win32' )
14-
15-
1611def normalize_text (text ):
1712 if text is None :
1813 return None
@@ -493,13 +488,10 @@ def collect_datetime(info_add):
493488
494489
495490def collect_sysconfig (info_add ):
496- # On Windows, sysconfig is not reliable to get macros used
497- # to build Python
498- if MS_WINDOWS :
499- return
500-
501491 import sysconfig
502492
493+ info_add ('sysconfig.is_python_build' , sysconfig .is_python_build ())
494+
503495 for name in (
504496 'ABIFLAGS' ,
505497 'ANDROID_API_LEVEL' ,
@@ -523,7 +515,9 @@ def collect_sysconfig(info_add):
523515 'Py_NOGIL' ,
524516 'SHELL' ,
525517 'SOABI' ,
518+ 'abs_builddir' ,
526519 'prefix' ,
520+ 'srcdir' ,
527521 ):
528522 value = sysconfig .get_config_var (name )
529523 if name == 'ANDROID_API_LEVEL' and not value :
@@ -711,6 +705,7 @@ def collect_resource(info_add):
711705
712706
713707def collect_test_socket (info_add ):
708+ import unittest
714709 try :
715710 from test import test_socket
716711 except (ImportError , unittest .SkipTest ):
@@ -896,6 +891,11 @@ def collect_fips(info_add):
896891 pass
897892
898893
894+ def collect_tempfile (info_add ):
895+ import tempfile
896+
897+ info_add ('tempfile.gettempdir' , tempfile .gettempdir ())
898+
899899def collect_info (info ):
900900 error = False
901901 info_add = info .add
@@ -930,6 +930,7 @@ def collect_info(info):
930930 collect_sysconfig ,
931931 collect_testcapi ,
932932 collect_testinternalcapi ,
933+ collect_tempfile ,
933934 collect_time ,
934935 collect_tkinter ,
935936 collect_windows ,
0 commit comments