https://github.com/python/cpython/commit/b2ca26875a75fdd70e39a8fe2b1b31b863794c41
commit: b2ca26875a75fdd70e39a8fe2b1b31b863794c41
branch: main
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2025-03-13T10:57:40+01:00
summary:
gh-131152: Remove unused imports from tests (part 2) (#131154)
files:
M Lib/test/test_free_threading/test_func_annotations.py
M Lib/test/test_free_threading/test_itertools_batched.py
M Lib/test/test_free_threading/test_methodcaller.py
M Lib/test/test_glob.py
M Lib/test/test_importlib/extension/test_case_sensitivity.py
M Lib/test/test_importlib/resources/test_files.py
M Lib/test/test_importlib/test_util.py
M Lib/test/test_locale.py
M Lib/test/test_pathlib/test_pathlib.py
M Lib/test/test_pathlib/test_pathlib_abc.py
M Lib/test/test_pkgutil.py
M Lib/test/test_pyrepl/support.py
M Lib/test/test_pyrepl/test_eventqueue.py
M Lib/test/test_shutil.py
M Lib/test/test_tarfile.py
M Lib/test/test_thread_local_bytecode.py
M Lib/test/test_types.py
M Lib/test/test_userdict.py
M Lib/test/test_userlist.py
M Lib/test/test_wmi.py
M Lib/test/test_zipfile/_path/test_path.py
M Lib/test/test_zipfile/test_core.py
diff --git a/Lib/test/test_free_threading/test_func_annotations.py
b/Lib/test/test_free_threading/test_func_annotations.py
index 1a6461953d4aec..b3e92956072c75 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 fa9e06bf07fa26..a754b4f9ea9902 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 8846b0010012f2..0a03e38cf2c878 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 da73769c16e9af..6e5fc2939c6f2c 100644
--- a/Lib/test/test_glob.py
+++ b/Lib/test/test_glob.py
@@ -6,7 +6,6 @@
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 40311627a144e8..5183719162edd6 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 db8a4e62a32dc6..3ce44999f98ee5 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 6332548291987b..5de89714eb50c7 100644
--- a/Lib/test/test_importlib/test_util.py
+++ b/Lib/test/test_importlib/test_util.py
@@ -9,7 +9,6 @@
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 c025ed4108fb58..dc1ba258e0b81b 100644
--- a/Lib/test/test_locale.py
+++ b/Lib/test/test_locale.py
@@ -489,7 +489,6 @@ def test_defaults_UTF8(self):
# 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 b9725af0c988f7..51814ae970dab0 100644
--- a/Lib/test/test_pathlib/test_pathlib.py
+++ b/Lib/test/test_pathlib/test_pathlib.py
@@ -18,7 +18,6 @@
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 cff4e3372b7a3b..08dad4d28b8eb3 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 736b83711def03..d4faaaeca00457 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 45e3bf758f17de..db7c68681f62c4 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 b25bdb956b0d14..afb557103424a6 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 078ddd6c431b37..86bdc302ea76fd 100644
--- a/Lib/test/test_shutil.py
+++ b/Lib/test/test_shutil.py
@@ -10,7 +10,6 @@
import os.path
import errno
import functools
-import pathlib
import subprocess
import random
import string
@@ -32,7 +31,6 @@
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 54d329a15d4d25..3e4cf8dd56db08 100644
--- a/Lib/test/test_tarfile.py
+++ b/Lib/test/test_tarfile.py
@@ -19,7 +19,6 @@
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 ea52fb888ce25d..d5c56db8d5da58 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 5a65b5dacaf581..f014f7e9ee08c9 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 9bd842eda5b49c..ace84ef564df72 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 e82e88f3f3ed1d..d3d9f4cff8da3a 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 111f990656ced5..ac7c9cb3a5a493 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 1ee45f5fc57104..0afabc0c6683c4 100644
--- a/Lib/test/test_zipfile/_path/test_path.py
+++ b/Lib/test/test_zipfile/_path/test_path.py
@@ -5,7 +5,6 @@
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 6b1fe56074d561..44e8190ac6710b 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 (
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
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]