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 ):
1712if text is None :
1813return 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-
501491import sysconfig
502492
493+ info_add ('sysconfig.is_python_build' ,sysconfig .is_python_build ())
494+
503495for 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 ):
528522value = sysconfig .get_config_var (name )
529523if 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
714709try :
715710from test import test_socket
716711except (ImportError ,unittest .SkipTest ):
@@ -896,6 +891,11 @@ def collect_fips(info_add):
896891pass
897892
898893
894+ def collect_tempfile (info_add ):
895+ import tempfile
896+
897+ info_add ('tempfile.gettempdir' ,tempfile .gettempdir ())
898+
899899def collect_info (info ):
900900error = False
901901info_add = info .add
@@ -930,6 +930,7 @@ def collect_info(info):
930930collect_sysconfig ,
931931collect_testcapi ,
932932collect_testinternalcapi ,
933+ collect_tempfile ,
933934collect_time ,
934935collect_tkinter ,
935936collect_windows ,