Skip to content

Commit 57572b1

Browse files
authored
bpo-40443: Remove unused imports in tests (GH-19805)
1 parent 69e802e commit 57572b1

17 files changed

+4
-20
lines changed

Lib/test/test_parser.py

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import unittest
99
import operator
1010
import struct
11-
import sys
1211
from test import support
1312
from test.support.script_helper import assert_python_failure
1413
from test.support.script_helper import assert_python_ok

Lib/test/test_peg_parser.py

-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import ast
2-
import os
3-
import sys
42
import _peg_parser as peg_parser
53
import unittest
6-
from pathlib import PurePath
74
from typing import Any, Union, Iterable, Tuple
85
from textwrap import dedent
96
from test import support

Lib/test/test_platform.py

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import subprocess
44
import sys
55
import unittest
6-
import collections
76
from unittest import mock
87

98
from test import support

Lib/test/test_positional_only_arg.py

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import dis
44
import pickle
55
import unittest
6-
import sys
76

87
from test.support import check_syntax_error, use_old_parser
98

Lib/test/test_pstats.py

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from pstats import SortKey
66

77
import pstats
8-
import time
98
import cProfile
109

1110
class AddCallersTestCase(unittest.TestCase):

Lib/test/test_re.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2217,7 +2217,7 @@ def test_re_benchmarks(self):
22172217

22182218
def test_re_tests(self):
22192219
're_tests test suite'
2220-
from test.re_tests import tests, SUCCEED, FAIL, SYNTAX_ERROR
2220+
from test.re_tests import tests, FAIL, SYNTAX_ERROR
22212221
for t in tests:
22222222
pattern = s = outcome = repl = expected = None
22232223
if len(t) == 5:

Lib/test/test_regrtest.py

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"""
66

77
import contextlib
8-
import faulthandler
98
import glob
109
import io
1110
import os.path

Lib/test/test_string_literals.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
import tempfile
3434
import unittest
3535
import warnings
36-
from test.support import check_syntax_warning, use_old_parser
36+
from test.support import use_old_parser
3737

3838

3939
TEMPLATE = r"""# coding: %s

Lib/test/test_support.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import contextlib
21
import errno
32
import importlib
43
import io

Lib/test/test_syntax.py

-1
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,6 @@
644644
"""
645645

646646
import re
647-
import sys
648647
import unittest
649648

650649
from test import support

Lib/test/test_tempfile.py

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import io
55
import os
66
import pathlib
7-
import signal
87
import sys
98
import re
109
import warnings

Lib/test/test_tools/test_c_analyzer/test_parser/test_preprocessor.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import itertools
21
import textwrap
32
import unittest
43
import sys

Lib/test/test_tools/test_lll.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""Tests for the lll script in the Tools/script directory."""
22

33
import os
4-
import sys
54
import tempfile
65
from test import support
76
from test.test_tools import skip_if_missing, import_tool

Lib/test/test_tools/test_pathfix.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import sys
44
import unittest
55
from test import support
6-
from test.test_tools import import_tool, scriptsdir, skip_if_missing
6+
from test.test_tools import scriptsdir, skip_if_missing
77

88

99
# need Tools/script/ directory: skip if run on Python installed on the system

Lib/test/test_typing.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import pickle
44
import re
55
import sys
6-
from unittest import TestCase, main, skipUnless, SkipTest, skip
6+
from unittest import TestCase, main, skipUnless, skip
77
from copy import copy, deepcopy
88

99
from typing import Any, NoReturn

Lib/test/test_unparse.py

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import random
77
import tokenize
88
import ast
9-
import sys
109

1110

1211
def read_pyfile(filename):

Lib/test/test_uuid.py

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
import io
77
import os
88
import pickle
9-
import shutil
10-
import subprocess
119
import sys
1210
import weakref
1311
from unittest import mock

0 commit comments

Comments
 (0)