diff options
author | Victor Stinner <vstinner@python.org> | 2023-09-12 02:50:05 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-12 02:50:05 (GMT) |
commit | df4f0fe203a66ffa61c8ea71d30c87d13b973d3b (patch) | |
tree | d9eaa9db368f14a5c2c99576db38c1dd2aef8b2c /Lib/test/pythoninfo.py | |
parent | 936376916100681d46db117bae0ec05adf338051 (diff) | |
download | cpython-df4f0fe203a66ffa61c8ea71d30c87d13b973d3b.zip cpython-df4f0fe203a66ffa61c8ea71d30c87d13b973d3b.tar.gz cpython-df4f0fe203a66ffa61c8ea71d30c87d13b973d3b.tar.bz2 |
gh-109276: Complete test.pythoninfo (#109312)
* Enable collect_sysconfig() on Windows.
* Add sysconfig 'abs_builddir' and 'srcdir'
* Add sysconfig.is_python_build()
* Add tempfile.gettempdir()
* Remove compatiblity with Python 2.7 (print_function).
Diffstat (limited to 'Lib/test/pythoninfo.py')
-rw-r--r-- | Lib/test/pythoninfo.py | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/Lib/test/pythoninfo.py b/Lib/test/pythoninfo.py index b25def7..e52fa6b 100644 --- a/Lib/test/pythoninfo.py +++ b/Lib/test/pythoninfo.py @@ -1,18 +1,13 @@ """ Collect various information about Python to help debugging test failures. """ -from __future__ import print_function import errno import re import sys import traceback -import unittest import warnings -MS_WINDOWS = (sys.platform == 'win32') - - def normalize_text(text): if text is None: return None @@ -493,13 +488,10 @@ def collect_datetime(info_add): def collect_sysconfig(info_add): - # On Windows, sysconfig is not reliable to get macros used - # to build Python - if MS_WINDOWS: - return - import sysconfig + info_add('sysconfig.is_python_build', sysconfig.is_python_build()) + for name in ( 'ABIFLAGS', 'ANDROID_API_LEVEL', @@ -523,7 +515,9 @@ def collect_sysconfig(info_add): 'Py_NOGIL', 'SHELL', 'SOABI', + 'abs_builddir', 'prefix', + 'srcdir', ): value = sysconfig.get_config_var(name) if name == 'ANDROID_API_LEVEL' and not value: @@ -711,6 +705,7 @@ def collect_resource(info_add): def collect_test_socket(info_add): + import unittest try: from test import test_socket except (ImportError, unittest.SkipTest): @@ -896,6 +891,11 @@ def collect_fips(info_add): pass +def collect_tempfile(info_add): + import tempfile + + info_add('tempfile.gettempdir', tempfile.gettempdir()) + def collect_info(info): error = False info_add = info.add @@ -930,6 +930,7 @@ def collect_info(info): collect_sysconfig, collect_testcapi, collect_testinternalcapi, + collect_tempfile, collect_time, collect_tkinter, collect_windows, |