summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2025-03-13 09:55:23 (GMT)
committerGitHub <noreply@github.com>2025-03-13 09:55:23 (GMT)
commit73ab9e2eded4706ccdc0ab0286ff986bb552a1bf (patch)
tree8f0accd30c22a574b9ffb94b8d2ae34ba6c2f680
parent0c6c52f49605f757c4a125ca195a2123bd930b93 (diff)
downloadcpython-73ab9e2eded4706ccdc0ab0286ff986bb552a1bf.zip
cpython-73ab9e2eded4706ccdc0ab0286ff986bb552a1bf.tar.gz
cpython-73ab9e2eded4706ccdc0ab0286ff986bb552a1bf.tar.bz2
gh-131152: Remove unused imports from tests (#131153)
-rw-r--r--Lib/test/libregrtest/main.py2
-rw-r--r--Lib/test/libregrtest/parallel_case.py1
-rw-r--r--Lib/test/libregrtest/utils.py1
-rw-r--r--Lib/test/support/venv.py1
-rw-r--r--Lib/test/test_asyncio/test_events.py2
-rw-r--r--Lib/test/test_asyncio/test_streams.py5
-rw-r--r--Lib/test/test_asyncio/test_unix_events.py3
-rw-r--r--Lib/test/test_asyncio/utils.py1
-rw-r--r--Lib/test/test_builtin.py1
-rw-r--r--Lib/test/test_bytes.py1
-rw-r--r--Lib/test/test_call.py6
-rw-r--r--Lib/test/test_capi/test_config.py1
-rw-r--r--Lib/test/test_capi/test_file.py1
-rw-r--r--Lib/test/test_capi/test_getargs.py3
-rw-r--r--Lib/test/test_capi/test_number.py3
-rw-r--r--Lib/test/test_capi/test_tuple.py2
-rw-r--r--Lib/test/test_compile.py1
-rw-r--r--Lib/test/test_concurrent_futures/test_interpreter_pool.py1
-rw-r--r--Lib/test/test_concurrent_futures/test_process_pool.py1
-rw-r--r--Lib/test/test_ctypes/test_struct_fields.py3
-rw-r--r--Lib/test/test_dynamic.py2
-rw-r--r--Lib/test/test_embed.py2
22 files changed, 10 insertions, 34 deletions
diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py
index 8274fb9..a3638b4 100644
--- a/Lib/test/libregrtest/main.py
+++ b/Lib/test/libregrtest/main.py
@@ -15,7 +15,7 @@ from .cmdline import _parse_args, Namespace
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 09d9d28..8eb3c31 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 3eff9e7..c4a1506 100644
--- a/Lib/test/libregrtest/utils.py
+++ b/Lib/test/libregrtest/utils.py
@@ -7,7 +7,6 @@ import platform
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 7bfb9e4..757392b 100644
--- a/Lib/test/support/venv.py
+++ b/Lib/test/support/venv.py
@@ -6,7 +6,6 @@ import shlex
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 3506960..ead2299 100644
--- a/Lib/test/test_asyncio/test_events.py
+++ b/Lib/test/test_asyncio/test_events.py
@@ -22,7 +22,6 @@ import errno
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 import support
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 673c6b4..0b47b2b 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 @@ except ImportError:
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 ebb4cc0..7f9f5a1 100644
--- a/Lib/test/test_asyncio/test_unix_events.py
+++ b/Lib/test/test_asyncio/test_unix_events.py
@@ -10,11 +10,9 @@ import signal
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 @@ if sys.platform == 'win32':
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 35ce138..c611057 100644
--- a/Lib/test/test_asyncio/utils.py
+++ b/Lib/test/test_asyncio/utils.py
@@ -14,7 +14,6 @@ import sys
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 0d4b42e..a0bb685 100644
--- a/Lib/test/test_builtin.py
+++ b/Lib/test/test_builtin.py
@@ -16,7 +16,6 @@ import platform
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 d5490a2..115899d 100644
--- a/Lib/test/test_bytes.py
+++ b/Lib/test/test_bytes.py
@@ -11,7 +11,6 @@ import sys
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 f1b6c55..185ae84 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 a3179ef..8dde2ac 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 b576775..1a55c76 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 703d228..05d25a8d 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 b915dee..8e70703 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 6349467..7c07bc6 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 437b577..f5d757d 100644
--- a/Lib/test/test_compile.py
+++ b/Lib/test/test_compile.py
@@ -2,7 +2,6 @@ import contextlib
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 93eec08..f6c62ae 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 contextlib
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 62503bf..3f13a19 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 1b3e64e..aafdb35 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 19e779c..bddfbb5 100644
--- a/Lib/test/test_dynamic.py
+++ b/Lib/test/test_dynamic.py
@@ -4,7 +4,7 @@ import builtins
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 de54d06..fdece75 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