Skip to content

Commit 73ab9e2

Browse files
authored
gh-131152: Remove unused imports from tests (#131153)
1 parent 0c6c52f commit 73ab9e2

22 files changed

+10
-34
lines changed

Lib/test/libregrtest/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from .findtests import findtests, split_test_packages, list_cases
1616
from .logger import Logger
1717
from .pgo import setup_pgo_tests
18-
from .result import State, TestResult
18+
from .result import TestResult
1919
from .results import TestResults, EXITCODE_INTERRUPTED
2020
from .runtests import RunTests, HuntRefleak
2121
from .setup import setup_process, setup_test_dir

Lib/test/libregrtest/parallel_case.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""Run a test case multiple times in parallel threads."""
22

33
import copy
4-
import functools
54
import threading
65
import unittest
76

Lib/test/libregrtest/utils.py

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import random
88
import re
99
import shlex
10-
import signal
1110
import subprocess
1211
import sys
1312
import sysconfig

Lib/test/support/venv.py

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import sys
77
import sysconfig
88
import tempfile
9-
import unittest
109
import venv
1110

1211

Lib/test/test_asyncio/test_events.py

-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import unittest
2323
from unittest import mock
2424
import weakref
25-
import warnings
2625
if sys.platform not in ('win32', 'vxworks'):
2726
import tty
2827

@@ -36,7 +35,6 @@
3635
from test.support import socket_helper
3736
from test.support import threading_helper
3837
from test.support import ALWAYS_EQ, LARGEST, SMALLEST
39-
from test.support import warnings_helper
4038

4139
def tearDownModule():
4240
asyncio._set_event_loop_policy(None)

Lib/test/test_asyncio/test_streams.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
"""Tests for streams.py."""
22

33
import gc
4-
import os
54
import queue
65
import pickle
76
import socket
8-
import sys
97
import threading
108
import unittest
119
from unittest import mock
12-
import warnings
1310
try:
1411
import ssl
1512
except ImportError:
1613
ssl = None
1714

1815
import asyncio
1916
from test.test_asyncio import utils as test_utils
20-
from test.support import requires_subprocess, socket_helper
17+
from test.support import socket_helper
2118

2219

2320
def tearDownModule():

Lib/test/test_asyncio/test_unix_events.py

-3
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@
1010
import socket
1111
import stat
1212
import sys
13-
import threading
1413
import time
1514
import unittest
1615
from unittest import mock
17-
import warnings
1816

1917
from test import support
2018
from test.support import os_helper
@@ -27,7 +25,6 @@
2725

2826

2927
import asyncio
30-
from asyncio import log
3128
from asyncio import unix_events
3229
from test.test_asyncio import utils as test_utils
3330

Lib/test/test_asyncio/utils.py

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import threading
1515
import unittest
1616
import weakref
17-
import warnings
1817
from ast import literal_eval
1918
from unittest import mock
2019

Lib/test/test_builtin.py

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import random
1717
import re
1818
import sys
19-
import textwrap
2019
import traceback
2120
import types
2221
import typing

Lib/test/test_bytes.py

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import copy
1212
import functools
1313
import pickle
14-
import sysconfig
1514
import tempfile
1615
import textwrap
1716
import threading

Lib/test/test_call.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import unittest
22
from test.support import (cpython_only, is_wasi, requires_limited_api, Py_DEBUG,
3-
set_recursion_limit, skip_on_s390x, exceeds_recursion_limit, skip_emscripten_stack_overflow, skip_wasi_stack_overflow,
4-
skip_if_sanitizer, import_helper)
3+
set_recursion_limit, skip_on_s390x,
4+
skip_emscripten_stack_overflow,
5+
skip_wasi_stack_overflow, skip_if_sanitizer,
6+
import_helper)
57
try:
68
import _testcapi
79
except ImportError:

Lib/test/test_capi/test_config.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""
22
Tests PyConfig_Get() and PyConfig_Set() C API (PEP 741).
33
"""
4-
import os
54
import sys
65
import sysconfig
76
import types

Lib/test/test_capi/test_file.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import io
22
import os
33
import unittest
4-
import warnings
54
from test import support
65
from test.support import import_helper, os_helper, warnings_helper
76

Lib/test/test_capi/test_getargs.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import unittest
2-
import math
31
import string
42
import sys
3+
import unittest
54
from test import support
65
from test.support import import_helper
76
from test.support import script_helper

Lib/test/test_capi/test_number.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import itertools
22
import operator
3-
import sys
43
import unittest
54
import warnings
65

7-
from test.support import cpython_only, import_helper
6+
from test.support import import_helper
87

98
_testcapi = import_helper.import_module('_testcapi')
109
from _testcapi import PY_SSIZE_T_MAX, PY_SSIZE_T_MIN

Lib/test/test_capi/test_tuple.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import unittest
2-
import sys
32
import gc
4-
from collections import namedtuple
53
from test.support import import_helper
64

75
_testcapi = import_helper.import_module('_testcapi')

Lib/test/test_compile.py

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import dis
33
import io
44
import itertools
5-
import marshal
65
import math
76
import opcode
87
import os

Lib/test/test_concurrent_futures/test_interpreter_pool.py

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import io
44
import os
55
import pickle
6-
import sys
76
import time
87
import unittest
98
from concurrent.futures.interpreter import (

Lib/test/test_concurrent_futures/test_process_pool.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import os
22
import queue
3-
import signal
43
import sys
54
import threading
65
import time

Lib/test/test_ctypes/test_struct_fields.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import unittest
22
import sys
33
from ctypes import Structure, Union, sizeof, c_char, c_int
4-
from ._support import (CField, Py_TPFLAGS_DISALLOW_INSTANTIATION,
5-
Py_TPFLAGS_IMMUTABLETYPE)
4+
from ._support import CField, Py_TPFLAGS_IMMUTABLETYPE
65

76

87
NOTHING = object()

Lib/test/test_dynamic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import sys
55
import unittest
66

7-
from test.support import swap_item, swap_attr, skip_wasi_stack_overflow, Py_DEBUG
7+
from test.support import swap_item, swap_attr, skip_wasi_stack_overflow
88

99

1010
class RebindBuiltinsTests(unittest.TestCase):

Lib/test/test_embed.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
# Run the tests in Programs/_testembed.c (tests for the CPython embedding APIs)
22
from test import support
3-
from test.libregrtest.utils import get_build_info
43
from test.support import import_helper, os_helper, threading_helper, MS_WINDOWS
54
import unittest
65

76
from collections import namedtuple
87
import contextlib
9-
import io
108
import json
119
import os
1210
import os.path

0 commit comments

Comments
 (0)