summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2025-03-13 09:57:40 (GMT)
committerGitHub <noreply@github.com>2025-03-13 09:57:40 (GMT)
commitb2ca26875a75fdd70e39a8fe2b1b31b863794c41 (patch)
tree970c97d7f7435145c9557c94763419d5b04a6e34
parent50e9eba32cdade34350a9f29ff2139a35e8876c0 (diff)
downloadcpython-b2ca26875a75fdd70e39a8fe2b1b31b863794c41.zip
cpython-b2ca26875a75fdd70e39a8fe2b1b31b863794c41.tar.gz
cpython-b2ca26875a75fdd70e39a8fe2b1b31b863794c41.tar.bz2
gh-131152: Remove unused imports from tests (part 2) (#131154)
-rw-r--r--Lib/test/test_free_threading/test_func_annotations.py2
-rw-r--r--Lib/test/test_free_threading/test_itertools_batched.py1
-rw-r--r--Lib/test/test_free_threading/test_methodcaller.py1
-rw-r--r--Lib/test/test_glob.py1
-rw-r--r--Lib/test/test_importlib/extension/test_case_sensitivity.py1
-rw-r--r--Lib/test/test_importlib/resources/test_files.py2
-rw-r--r--Lib/test/test_importlib/test_util.py1
-rw-r--r--Lib/test/test_locale.py1
-rw-r--r--Lib/test/test_pathlib/test_pathlib.py1
-rw-r--r--Lib/test/test_pathlib/test_pathlib_abc.py4
-rw-r--r--Lib/test/test_pkgutil.py4
-rw-r--r--Lib/test/test_pyrepl/support.py1
-rw-r--r--Lib/test/test_pyrepl/test_eventqueue.py1
-rw-r--r--Lib/test/test_shutil.py2
-rw-r--r--Lib/test/test_tarfile.py1
-rw-r--r--Lib/test/test_thread_local_bytecode.py1
-rw-r--r--Lib/test/test_types.py3
-rw-r--r--Lib/test/test_userdict.py2
-rw-r--r--Lib/test/test_userlist.py1
-rw-r--r--Lib/test/test_wmi.py1
-rw-r--r--Lib/test/test_zipfile/_path/test_path.py1
-rw-r--r--Lib/test/test_zipfile/test_core.py1
22 files changed, 6 insertions, 28 deletions
diff --git a/Lib/test/test_free_threading/test_func_annotations.py b/Lib/test/test_free_threading/test_func_annotations.py
index 1a64619..b3e9295 100644
--- a/Lib/test/test_free_threading/test_func_annotations.py
+++ b/Lib/test/test_free_threading/test_func_annotations.py
@@ -1,7 +1,7 @@
import concurrent.futures
import unittest
import inspect
-from threading import Thread, Barrier
+from threading import Barrier
from unittest import TestCase
from test.support import threading_helper, Py_GIL_DISABLED
diff --git a/Lib/test/test_free_threading/test_itertools_batched.py b/Lib/test/test_free_threading/test_itertools_batched.py
index fa9e06b..a754b4f 100644
--- a/Lib/test/test_free_threading/test_itertools_batched.py
+++ b/Lib/test/test_free_threading/test_itertools_batched.py
@@ -1,5 +1,4 @@
import unittest
-import sys
from threading import Thread, Barrier
from itertools import batched
from test.support import threading_helper
diff --git a/Lib/test/test_free_threading/test_methodcaller.py b/Lib/test/test_free_threading/test_methodcaller.py
index 8846b00..0a03e38 100644
--- a/Lib/test/test_free_threading/test_methodcaller.py
+++ b/Lib/test/test_free_threading/test_methodcaller.py
@@ -1,6 +1,5 @@
import unittest
from threading import Thread
-from test.support import threading_helper
from operator import methodcaller
diff --git a/Lib/test/test_glob.py b/Lib/test/test_glob.py
index da73769..6e5fc29 100644
--- a/Lib/test/test_glob.py
+++ b/Lib/test/test_glob.py
@@ -6,7 +6,6 @@ import sys
import unittest
import warnings
-from test import support
from test.support import is_wasi, Py_DEBUG
from test.support.os_helper import (TESTFN, skip_unless_symlink,
can_symlink, create_empty_file, change_cwd)
diff --git a/Lib/test/test_importlib/extension/test_case_sensitivity.py b/Lib/test/test_importlib/extension/test_case_sensitivity.py
index 4031162..5183719 100644
--- a/Lib/test/test_importlib/extension/test_case_sensitivity.py
+++ b/Lib/test/test_importlib/extension/test_case_sensitivity.py
@@ -1,4 +1,3 @@
-from importlib import _bootstrap_external
from test.support import os_helper
import unittest
import sys
diff --git a/Lib/test/test_importlib/resources/test_files.py b/Lib/test/test_importlib/resources/test_files.py
index db8a4e6..3ce4499 100644
--- a/Lib/test/test_importlib/resources/test_files.py
+++ b/Lib/test/test_importlib/resources/test_files.py
@@ -1,7 +1,5 @@
-import os
import pathlib
import py_compile
-import shutil
import textwrap
import unittest
import warnings
diff --git a/Lib/test/test_importlib/test_util.py b/Lib/test/test_importlib/test_util.py
index 6332548..5de8971 100644
--- a/Lib/test/test_importlib/test_util.py
+++ b/Lib/test/test_importlib/test_util.py
@@ -9,7 +9,6 @@ import importlib.util
from importlib import _bootstrap_external
import os
import pathlib
-import re
import string
import sys
from test import support
diff --git a/Lib/test/test_locale.py b/Lib/test/test_locale.py
index c025ed4..dc1ba25 100644
--- a/Lib/test/test_locale.py
+++ b/Lib/test/test_locale.py
@@ -489,7 +489,6 @@ class TestMiscellaneous(unittest.TestCase):
# valid. Furthermore LC_CTYPE=UTF is used by the UTF-8 locale coercing
# during interpreter startup (on macOS).
import _locale
- import os
self.assertEqual(locale._parse_localename('UTF-8'), (None, 'UTF-8'))
diff --git a/Lib/test/test_pathlib/test_pathlib.py b/Lib/test/test_pathlib/test_pathlib.py
index b9725af..51814ae 100644
--- a/Lib/test/test_pathlib/test_pathlib.py
+++ b/Lib/test/test_pathlib/test_pathlib.py
@@ -18,7 +18,6 @@ from urllib.request import pathname2url
from test.support import import_helper
from test.support import is_emscripten, is_wasi
from test.support import infinite_recursion
-from test.support import swap_attr
from test.support import os_helper
from test.support.os_helper import TESTFN, FakePath
from test.test_pathlib import test_pathlib_abc
diff --git a/Lib/test/test_pathlib/test_pathlib_abc.py b/Lib/test/test_pathlib/test_pathlib_abc.py
index cff4e33..08dad4d 100644
--- a/Lib/test/test_pathlib/test_pathlib_abc.py
+++ b/Lib/test/test_pathlib/test_pathlib_abc.py
@@ -1,11 +1,9 @@
-import collections
import io
import os
import errno
import unittest
-from pathlib._os import magic_open
-from pathlib.types import _PathParser, PathInfo, _JoinablePath, _ReadablePath, _WritablePath
+from pathlib.types import _JoinablePath, _ReadablePath, _WritablePath
import posixpath
from test.support.os_helper import TESTFN
diff --git a/Lib/test/test_pkgutil.py b/Lib/test/test_pkgutil.py
index 736b837..d4faaae 100644
--- a/Lib/test/test_pkgutil.py
+++ b/Lib/test/test_pkgutil.py
@@ -1,6 +1,6 @@
from pathlib import Path
-from test.support.import_helper import unload, CleanImport
-from test.support.warnings_helper import check_warnings, ignore_warnings
+from test.support.import_helper import unload
+from test.support.warnings_helper import check_warnings
import unittest
import sys
import importlib
diff --git a/Lib/test/test_pyrepl/support.py b/Lib/test/test_pyrepl/support.py
index 45e3bf7..db7c686 100644
--- a/Lib/test/test_pyrepl/support.py
+++ b/Lib/test/test_pyrepl/support.py
@@ -1,4 +1,3 @@
-import os
from code import InteractiveConsole
from functools import partial
from typing import Iterable
diff --git a/Lib/test/test_pyrepl/test_eventqueue.py b/Lib/test/test_pyrepl/test_eventqueue.py
index b25bdb9..afb5571 100644
--- a/Lib/test/test_pyrepl/test_eventqueue.py
+++ b/Lib/test/test_pyrepl/test_eventqueue.py
@@ -1,6 +1,5 @@
import tempfile
import unittest
-import sys
from unittest.mock import patch
from test import support
diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py
index 078ddd6..86bdc30 100644
--- a/Lib/test/test_shutil.py
+++ b/Lib/test/test_shutil.py
@@ -10,7 +10,6 @@ import os
import os.path
import errno
import functools
-import pathlib
import subprocess
import random
import string
@@ -32,7 +31,6 @@ except ImportError:
from test import support
from test.support import os_helper
from test.support.os_helper import TESTFN, FakePath
-from test.support import warnings_helper
TESTFN2 = TESTFN + "2"
TESTFN_SRC = TESTFN + "_SRC"
diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py
index 54d329a..3e4cf8d 100644
--- a/Lib/test/test_tarfile.py
+++ b/Lib/test/test_tarfile.py
@@ -19,7 +19,6 @@ from test import archiver_tests
from test import support
from test.support import os_helper
from test.support import script_helper
-from test.support import warnings_helper
# Check for our compression modules.
try:
diff --git a/Lib/test/test_thread_local_bytecode.py b/Lib/test/test_thread_local_bytecode.py
index ea52fb8..d5c56db 100644
--- a/Lib/test/test_thread_local_bytecode.py
+++ b/Lib/test/test_thread_local_bytecode.py
@@ -1,5 +1,4 @@
"""Tests for thread-local bytecode."""
-import dis
import textwrap
import unittest
diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py
index 5a65b5d..f014f7e 100644
--- a/Lib/test/test_types.py
+++ b/Lib/test/test_types.py
@@ -1,8 +1,7 @@
# Python test set -- part 6, built-in types
from test.support import (
- run_with_locale, is_apple_mobile, cpython_only, no_rerun,
- iter_builtin_types, iter_slot_wrappers,
+ run_with_locale, cpython_only, no_rerun,
MISSING_C_DOCSTRINGS,
)
import collections.abc
diff --git a/Lib/test/test_userdict.py b/Lib/test/test_userdict.py
index 9bd842e..ace84ef 100644
--- a/Lib/test/test_userdict.py
+++ b/Lib/test/test_userdict.py
@@ -1,6 +1,6 @@
# Check every path through every method of UserDict
-from test import mapping_tests, support
+from test import mapping_tests
import unittest
import collections
diff --git a/Lib/test/test_userlist.py b/Lib/test/test_userlist.py
index e82e88f..d3d9f4c 100644
--- a/Lib/test/test_userlist.py
+++ b/Lib/test/test_userlist.py
@@ -3,7 +3,6 @@
from collections import UserList
from test import list_tests
import unittest
-from test import support
class UserListTest(list_tests.CommonTest):
diff --git a/Lib/test/test_wmi.py b/Lib/test/test_wmi.py
index 111f990..ac7c9cb 100644
--- a/Lib/test/test_wmi.py
+++ b/Lib/test/test_wmi.py
@@ -1,7 +1,6 @@
# Test the internal _wmi module on Windows
# This is used by the platform module, and potentially others
-import time
import unittest
from test import support
from test.support import import_helper
diff --git a/Lib/test/test_zipfile/_path/test_path.py b/Lib/test/test_zipfile/_path/test_path.py
index 1ee45f5..0afabc0 100644
--- a/Lib/test/test_zipfile/_path/test_path.py
+++ b/Lib/test/test_zipfile/_path/test_path.py
@@ -5,7 +5,6 @@ import pathlib
import pickle
import stat
import sys
-import time
import unittest
import zipfile
import zipfile._path
diff --git a/Lib/test/test_zipfile/test_core.py b/Lib/test/test_zipfile/test_core.py
index 6b1fe56..44e8190 100644
--- a/Lib/test/test_zipfile/test_core.py
+++ b/Lib/test/test_zipfile/test_core.py
@@ -24,7 +24,6 @@ from test.support import script_helper, os_helper
from test.support import (
findfile, requires_zlib, requires_bz2, requires_lzma,
captured_stdout, captured_stderr, requires_subprocess,
- is_emscripten
)
from test.support.os_helper import (
TESTFN, unlink, rmtree, temp_dir, temp_cwd, fd_count, FakePath