https://github.com/python/cpython/commit/73ab9e2eded4706ccdc0ab0286ff986bb552a1bf
commit: 73ab9e2eded4706ccdc0ab0286ff986bb552a1bf
branch: main
author: Victor Stinner <vstin...@python.org>
committer: vstinner <vstin...@python.org>
date: 2025-03-13T10:55:23+01:00
summary:

gh-131152: Remove unused imports from tests (#131153)

files:
M Lib/test/libregrtest/main.py
M Lib/test/libregrtest/parallel_case.py
M Lib/test/libregrtest/utils.py
M Lib/test/support/venv.py
M Lib/test/test_asyncio/test_events.py
M Lib/test/test_asyncio/test_streams.py
M Lib/test/test_asyncio/test_unix_events.py
M Lib/test/test_asyncio/utils.py
M Lib/test/test_builtin.py
M Lib/test/test_bytes.py
M Lib/test/test_call.py
M Lib/test/test_capi/test_config.py
M Lib/test/test_capi/test_file.py
M Lib/test/test_capi/test_getargs.py
M Lib/test/test_capi/test_number.py
M Lib/test/test_capi/test_tuple.py
M Lib/test/test_compile.py
M Lib/test/test_concurrent_futures/test_interpreter_pool.py
M Lib/test/test_concurrent_futures/test_process_pool.py
M Lib/test/test_ctypes/test_struct_fields.py
M Lib/test/test_dynamic.py
M Lib/test/test_embed.py

diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py
index 8274fb925028ae..a3638b46eaf8c4 100644
--- a/Lib/test/libregrtest/main.py
+++ b/Lib/test/libregrtest/main.py
@@ -15,7 +15,7 @@
 from .findtests import findtests, split_test_packages, list_cases
 from .logger import Logger
 from .pgo import setup_pgo_tests
-from .result import State, TestResult
+from .result import TestResult
 from .results import TestResults, EXITCODE_INTERRUPTED
 from .runtests import RunTests, HuntRefleak
 from .setup import setup_process, setup_test_dir
diff --git a/Lib/test/libregrtest/parallel_case.py 
b/Lib/test/libregrtest/parallel_case.py
index 09d9d2831e86b8..8eb3c31491689d 100644
--- a/Lib/test/libregrtest/parallel_case.py
+++ b/Lib/test/libregrtest/parallel_case.py
@@ -1,7 +1,6 @@
 """Run a test case multiple times in parallel threads."""
 
 import copy
-import functools
 import threading
 import unittest
 
diff --git a/Lib/test/libregrtest/utils.py b/Lib/test/libregrtest/utils.py
index 3eff9e753b6d84..c4a1506c9a7d60 100644
--- a/Lib/test/libregrtest/utils.py
+++ b/Lib/test/libregrtest/utils.py
@@ -7,7 +7,6 @@
 import random
 import re
 import shlex
-import signal
 import subprocess
 import sys
 import sysconfig
diff --git a/Lib/test/support/venv.py b/Lib/test/support/venv.py
index 7bfb9e4f3c479f..757392b51c8117 100644
--- a/Lib/test/support/venv.py
+++ b/Lib/test/support/venv.py
@@ -6,7 +6,6 @@
 import sys
 import sysconfig
 import tempfile
-import unittest
 import venv
 
 
diff --git a/Lib/test/test_asyncio/test_events.py 
b/Lib/test/test_asyncio/test_events.py
index 35069608d8163a..ead22999bfeac1 100644
--- a/Lib/test/test_asyncio/test_events.py
+++ b/Lib/test/test_asyncio/test_events.py
@@ -22,7 +22,6 @@
 import unittest
 from unittest import mock
 import weakref
-import warnings
 if sys.platform not in ('win32', 'vxworks'):
     import tty
 
@@ -36,7 +35,6 @@
 from test.support import socket_helper
 from test.support import threading_helper
 from test.support import ALWAYS_EQ, LARGEST, SMALLEST
-from test.support import warnings_helper
 
 def tearDownModule():
     asyncio._set_event_loop_policy(None)
diff --git a/Lib/test/test_asyncio/test_streams.py 
b/Lib/test/test_asyncio/test_streams.py
index 673c6b46c647f3..0b47b2b91a1fe5 100644
--- a/Lib/test/test_asyncio/test_streams.py
+++ b/Lib/test/test_asyncio/test_streams.py
@@ -1,15 +1,12 @@
 """Tests for streams.py."""
 
 import gc
-import os
 import queue
 import pickle
 import socket
-import sys
 import threading
 import unittest
 from unittest import mock
-import warnings
 try:
     import ssl
 except ImportError:
@@ -17,7 +14,7 @@
 
 import asyncio
 from test.test_asyncio import utils as test_utils
-from test.support import requires_subprocess, socket_helper
+from test.support import socket_helper
 
 
 def tearDownModule():
diff --git a/Lib/test/test_asyncio/test_unix_events.py 
b/Lib/test/test_asyncio/test_unix_events.py
index ebb4cc0f7b64fd..7f9f5a1abbcd99 100644
--- a/Lib/test/test_asyncio/test_unix_events.py
+++ b/Lib/test/test_asyncio/test_unix_events.py
@@ -10,11 +10,9 @@
 import socket
 import stat
 import sys
-import threading
 import time
 import unittest
 from unittest import mock
-import warnings
 
 from test import support
 from test.support import os_helper
@@ -27,7 +25,6 @@
 
 
 import asyncio
-from asyncio import log
 from asyncio import unix_events
 from test.test_asyncio import utils as test_utils
 
diff --git a/Lib/test/test_asyncio/utils.py b/Lib/test/test_asyncio/utils.py
index 35ce13896da08f..c61105712d3cff 100644
--- a/Lib/test/test_asyncio/utils.py
+++ b/Lib/test/test_asyncio/utils.py
@@ -14,7 +14,6 @@
 import threading
 import unittest
 import weakref
-import warnings
 from ast import literal_eval
 from unittest import mock
 
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py
index 0d4b42eb2ab7be..a0bb6855c8fa3c 100644
--- a/Lib/test/test_builtin.py
+++ b/Lib/test/test_builtin.py
@@ -16,7 +16,6 @@
 import random
 import re
 import sys
-import textwrap
 import traceback
 import types
 import typing
diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py
index d5490a20a0525d..115899d9f3d2b8 100644
--- a/Lib/test/test_bytes.py
+++ b/Lib/test/test_bytes.py
@@ -11,7 +11,6 @@
 import copy
 import functools
 import pickle
-import sysconfig
 import tempfile
 import textwrap
 import threading
diff --git a/Lib/test/test_call.py b/Lib/test/test_call.py
index f1b6c55999ebe0..185ae84dc4d19f 100644
--- a/Lib/test/test_call.py
+++ b/Lib/test/test_call.py
@@ -1,7 +1,9 @@
 import unittest
 from test.support import (cpython_only, is_wasi, requires_limited_api, 
Py_DEBUG,
-                          set_recursion_limit, skip_on_s390x, 
exceeds_recursion_limit, skip_emscripten_stack_overflow, 
skip_wasi_stack_overflow,
-                          skip_if_sanitizer, import_helper)
+                          set_recursion_limit, skip_on_s390x,
+                          skip_emscripten_stack_overflow,
+                          skip_wasi_stack_overflow, skip_if_sanitizer,
+                          import_helper)
 try:
     import _testcapi
 except ImportError:
diff --git a/Lib/test/test_capi/test_config.py 
b/Lib/test/test_capi/test_config.py
index a3179efe4a8235..8dde2ac1e00d89 100644
--- a/Lib/test/test_capi/test_config.py
+++ b/Lib/test/test_capi/test_config.py
@@ -1,7 +1,6 @@
 """
 Tests PyConfig_Get() and PyConfig_Set() C API (PEP 741).
 """
-import os
 import sys
 import sysconfig
 import types
diff --git a/Lib/test/test_capi/test_file.py b/Lib/test/test_capi/test_file.py
index b5767756992861..1a55c761054e44 100644
--- a/Lib/test/test_capi/test_file.py
+++ b/Lib/test/test_capi/test_file.py
@@ -1,7 +1,6 @@
 import io
 import os
 import unittest
-import warnings
 from test import support
 from test.support import import_helper, os_helper, warnings_helper
 
diff --git a/Lib/test/test_capi/test_getargs.py 
b/Lib/test/test_capi/test_getargs.py
index 703d228f92e713..05d25a8d510bf7 100644
--- a/Lib/test/test_capi/test_getargs.py
+++ b/Lib/test/test_capi/test_getargs.py
@@ -1,7 +1,6 @@
-import unittest
-import math
 import string
 import sys
+import unittest
 from test import support
 from test.support import import_helper
 from test.support import script_helper
diff --git a/Lib/test/test_capi/test_number.py 
b/Lib/test/test_capi/test_number.py
index b915dee37c7ca6..8e7070307d670f 100644
--- a/Lib/test/test_capi/test_number.py
+++ b/Lib/test/test_capi/test_number.py
@@ -1,10 +1,9 @@
 import itertools
 import operator
-import sys
 import unittest
 import warnings
 
-from test.support import cpython_only, import_helper
+from test.support import import_helper
 
 _testcapi = import_helper.import_module('_testcapi')
 from _testcapi import PY_SSIZE_T_MAX, PY_SSIZE_T_MIN
diff --git a/Lib/test/test_capi/test_tuple.py b/Lib/test/test_capi/test_tuple.py
index 6349467c5d6b70..7c07bc64e247c5 100644
--- a/Lib/test/test_capi/test_tuple.py
+++ b/Lib/test/test_capi/test_tuple.py
@@ -1,7 +1,5 @@
 import unittest
-import sys
 import gc
-from collections import namedtuple
 from test.support import import_helper
 
 _testcapi = import_helper.import_module('_testcapi')
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py
index 437b577f4d528a..f5d757d8fc72c9 100644
--- a/Lib/test/test_compile.py
+++ b/Lib/test/test_compile.py
@@ -2,7 +2,6 @@
 import dis
 import io
 import itertools
-import marshal
 import math
 import opcode
 import os
diff --git a/Lib/test/test_concurrent_futures/test_interpreter_pool.py 
b/Lib/test/test_concurrent_futures/test_interpreter_pool.py
index 93eec08bfe10d5..f6c62ae4b2021b 100644
--- a/Lib/test/test_concurrent_futures/test_interpreter_pool.py
+++ b/Lib/test/test_concurrent_futures/test_interpreter_pool.py
@@ -3,7 +3,6 @@
 import io
 import os
 import pickle
-import sys
 import time
 import unittest
 from concurrent.futures.interpreter import (
diff --git a/Lib/test/test_concurrent_futures/test_process_pool.py 
b/Lib/test/test_concurrent_futures/test_process_pool.py
index 62503bfa55774b..3f13a1900a4ca4 100644
--- a/Lib/test/test_concurrent_futures/test_process_pool.py
+++ b/Lib/test/test_concurrent_futures/test_process_pool.py
@@ -1,6 +1,5 @@
 import os
 import queue
-import signal
 import sys
 import threading
 import time
diff --git a/Lib/test/test_ctypes/test_struct_fields.py 
b/Lib/test/test_ctypes/test_struct_fields.py
index 1b3e64efd410b8..aafdb3582f2a25 100644
--- a/Lib/test/test_ctypes/test_struct_fields.py
+++ b/Lib/test/test_ctypes/test_struct_fields.py
@@ -1,8 +1,7 @@
 import unittest
 import sys
 from ctypes import Structure, Union, sizeof, c_char, c_int
-from ._support import (CField, Py_TPFLAGS_DISALLOW_INSTANTIATION,
-                       Py_TPFLAGS_IMMUTABLETYPE)
+from ._support import CField, Py_TPFLAGS_IMMUTABLETYPE
 
 
 NOTHING = object()
diff --git a/Lib/test/test_dynamic.py b/Lib/test/test_dynamic.py
index 19e779c46a2e84..bddfbb5d902828 100644
--- a/Lib/test/test_dynamic.py
+++ b/Lib/test/test_dynamic.py
@@ -4,7 +4,7 @@
 import sys
 import unittest
 
-from test.support import swap_item, swap_attr, skip_wasi_stack_overflow, 
Py_DEBUG
+from test.support import swap_item, swap_attr, skip_wasi_stack_overflow
 
 
 class RebindBuiltinsTests(unittest.TestCase):
diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py
index de54d06f305c20..fdece755a740de 100644
--- a/Lib/test/test_embed.py
+++ b/Lib/test/test_embed.py
@@ -1,12 +1,10 @@
 # Run the tests in Programs/_testembed.c (tests for the CPython embedding APIs)
 from test import support
-from test.libregrtest.utils import get_build_info
 from test.support import import_helper, os_helper, threading_helper, MS_WINDOWS
 import unittest
 
 from collections import namedtuple
 import contextlib
-import io
 import json
 import os
 import os.path

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to