Skip to content

gh-109276: Complete test.pythoninfo #109312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions Lib/test/pythoninfo.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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',
Expand All @@ -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:
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -930,6 +930,7 @@ def collect_info(info):
collect_sysconfig,
collect_testcapi,
collect_testinternalcapi,
collect_tempfile,
collect_time,
collect_tkinter,
collect_windows,
Expand Down