gh-131152: Remove unused imports from tests (part 2) (#131154)

This commit is contained in:
Victor Stinner 2025-03-13 10:57:40 +01:00 committed by GitHub
parent 50e9eba32c
commit b2ca26875a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 6 additions and 28 deletions

View file

@ -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

View file

@ -1,5 +1,4 @@
import unittest
import sys
from threading import Thread, Barrier
from itertools import batched
from test.support import threading_helper

View file

@ -1,6 +1,5 @@
import unittest
from threading import Thread
from test.support import threading_helper
from operator import methodcaller

View file

@ -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)

View file

@ -1,4 +1,3 @@
from importlib import _bootstrap_external
from test.support import os_helper
import unittest
import sys

View file

@ -1,7 +1,5 @@
import os
import pathlib
import py_compile
import shutil
import textwrap
import unittest
import warnings

View file

@ -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

View file

@ -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'))

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -1,4 +1,3 @@
import os
from code import InteractiveConsole
from functools import partial
from typing import Iterable

View file

@ -1,6 +1,5 @@
import tempfile
import unittest
import sys
from unittest.mock import patch
from test import support

View file

@ -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"

View file

@ -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:

View file

@ -1,5 +1,4 @@
"""Tests for thread-local bytecode."""
import dis
import textwrap
import unittest

View file

@ -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

View file

@ -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

View file

@ -3,7 +3,6 @@
from collections import UserList
from test import list_tests
import unittest
from test import support
class UserListTest(list_tests.CommonTest):

View file

@ -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

View file

@ -5,7 +5,6 @@ import pathlib
import pickle
import stat
import sys
import time
import unittest
import zipfile
import zipfile._path

View file

@ -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