Skip to content

Commit b2ca268

Browse files
authored
gh-131152: Remove unused imports from tests (part 2) (#131154)
1 parent 50e9eba commit b2ca268

22 files changed

+6
-28
lines changed

Lib/test/test_free_threading/test_func_annotations.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import concurrent.futures
22
import unittest
33
import inspect
4-
from threading import Thread, Barrier
4+
from threading import Barrier
55
from unittest import TestCase
66

77
from test.support import threading_helper, Py_GIL_DISABLED

Lib/test/test_free_threading/test_itertools_batched.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import unittest
2-
import sys
32
from threading import Thread, Barrier
43
from itertools import batched
54
from test.support import threading_helper

Lib/test/test_free_threading/test_methodcaller.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import unittest
22
from threading import Thread
3-
from test.support import threading_helper
43
from operator import methodcaller
54

65

Lib/test/test_glob.py

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import unittest
77
import warnings
88

9-
from test import support
109
from test.support import is_wasi, Py_DEBUG
1110
from test.support.os_helper import (TESTFN, skip_unless_symlink,
1211
can_symlink, create_empty_file, change_cwd)

Lib/test/test_importlib/extension/test_case_sensitivity.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from importlib import _bootstrap_external
21
from test.support import os_helper
32
import unittest
43
import sys

Lib/test/test_importlib/resources/test_files.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
import os
21
import pathlib
32
import py_compile
4-
import shutil
53
import textwrap
64
import unittest
75
import warnings

Lib/test/test_importlib/test_util.py

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from importlib import _bootstrap_external
1010
import os
1111
import pathlib
12-
import re
1312
import string
1413
import sys
1514
from test import support

Lib/test/test_locale.py

-1
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,6 @@ def test_defaults_UTF8(self):
489489
# valid. Furthermore LC_CTYPE=UTF is used by the UTF-8 locale coercing
490490
# during interpreter startup (on macOS).
491491
import _locale
492-
import os
493492

494493
self.assertEqual(locale._parse_localename('UTF-8'), (None, 'UTF-8'))
495494

Lib/test/test_pathlib/test_pathlib.py

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
from test.support import import_helper
1919
from test.support import is_emscripten, is_wasi
2020
from test.support import infinite_recursion
21-
from test.support import swap_attr
2221
from test.support import os_helper
2322
from test.support.os_helper import TESTFN, FakePath
2423
from test.test_pathlib import test_pathlib_abc

Lib/test/test_pathlib/test_pathlib_abc.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import collections
21
import io
32
import os
43
import errno
54
import unittest
65

7-
from pathlib._os import magic_open
8-
from pathlib.types import _PathParser, PathInfo, _JoinablePath, _ReadablePath, _WritablePath
6+
from pathlib.types import _JoinablePath, _ReadablePath, _WritablePath
97
import posixpath
108

119
from test.support.os_helper import TESTFN

Lib/test/test_pkgutil.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from pathlib import Path
2-
from test.support.import_helper import unload, CleanImport
3-
from test.support.warnings_helper import check_warnings, ignore_warnings
2+
from test.support.import_helper import unload
3+
from test.support.warnings_helper import check_warnings
44
import unittest
55
import sys
66
import importlib

Lib/test/test_pyrepl/support.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import os
21
from code import InteractiveConsole
32
from functools import partial
43
from typing import Iterable

Lib/test/test_pyrepl/test_eventqueue.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import tempfile
22
import unittest
3-
import sys
43
from unittest.mock import patch
54
from test import support
65

Lib/test/test_shutil.py

-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import os.path
1111
import errno
1212
import functools
13-
import pathlib
1413
import subprocess
1514
import random
1615
import string
@@ -32,7 +31,6 @@
3231
from test import support
3332
from test.support import os_helper
3433
from test.support.os_helper import TESTFN, FakePath
35-
from test.support import warnings_helper
3634

3735
TESTFN2 = TESTFN + "2"
3836
TESTFN_SRC = TESTFN + "_SRC"

Lib/test/test_tarfile.py

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
from test import support
2020
from test.support import os_helper
2121
from test.support import script_helper
22-
from test.support import warnings_helper
2322

2423
# Check for our compression modules.
2524
try:

Lib/test/test_thread_local_bytecode.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
"""Tests for thread-local bytecode."""
2-
import dis
32
import textwrap
43
import unittest
54

Lib/test/test_types.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# Python test set -- part 6, built-in types
22

33
from test.support import (
4-
run_with_locale, is_apple_mobile, cpython_only, no_rerun,
5-
iter_builtin_types, iter_slot_wrappers,
4+
run_with_locale, cpython_only, no_rerun,
65
MISSING_C_DOCSTRINGS,
76
)
87
import collections.abc

Lib/test/test_userdict.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Check every path through every method of UserDict
22

3-
from test import mapping_tests, support
3+
from test import mapping_tests
44
import unittest
55
import collections
66

Lib/test/test_userlist.py

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from collections import UserList
44
from test import list_tests
55
import unittest
6-
from test import support
76

87

98
class UserListTest(list_tests.CommonTest):

Lib/test/test_wmi.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Test the internal _wmi module on Windows
22
# This is used by the platform module, and potentially others
33

4-
import time
54
import unittest
65
from test import support
76
from test.support import import_helper

Lib/test/test_zipfile/_path/test_path.py

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import pickle
66
import stat
77
import sys
8-
import time
98
import unittest
109
import zipfile
1110
import zipfile._path

Lib/test/test_zipfile/test_core.py

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
from test.support import (
2525
findfile, requires_zlib, requires_bz2, requires_lzma,
2626
captured_stdout, captured_stderr, requires_subprocess,
27-
is_emscripten
2827
)
2928
from test.support.os_helper import (
3029
TESTFN, unlink, rmtree, temp_dir, temp_cwd, fd_count, FakePath

0 commit comments

Comments
 (0)