bpo-40443: Remove unused imports in tests (GH-19805) · python/cpython@57572b1 (original) (raw)

File tree

17 files changed

lines changed

17 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -8,7 +8,6 @@
8 8 import unittest
9 9 import operator
10 10 import struct
11 -import sys
12 11 from test import support
13 12 from test.support.script_helper import assert_python_failure
14 13 from test.support.script_helper import assert_python_ok
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
1 1 import ast
2 -import os
3 -import sys
4 2 import _peg_parser as peg_parser
5 3 import unittest
6 -from pathlib import PurePath
7 4 from typing import Any, Union, Iterable, Tuple
8 5 from textwrap import dedent
9 6 from test import support
Original file line number Diff line number Diff line change
@@ -3,7 +3,6 @@
3 3 import subprocess
4 4 import sys
5 5 import unittest
6 -import collections
7 6 from unittest import mock
8 7
9 8 from test import support
Original file line number Diff line number Diff line change
@@ -3,7 +3,6 @@
3 3 import dis
4 4 import pickle
5 5 import unittest
6 -import sys
7 6
8 7 from test.support import check_syntax_error, use_old_parser
9 8
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@
5 5 from pstats import SortKey
6 6
7 7 import pstats
8 -import time
9 8 import cProfile
10 9
11 10 class AddCallersTestCase(unittest.TestCase):
Original file line number Diff line number Diff line change
@@ -2217,7 +2217,7 @@ def test_re_benchmarks(self):
2217 2217
2218 2218 def test_re_tests(self):
2219 2219 '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
2221 2221 for t in tests:
2222 2222 pattern = s = outcome = repl = expected = None
2223 2223 if len(t) == 5:
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@
5 5 """
6 6
7 7 import contextlib
8 -import faulthandler
9 8 import glob
10 9 import io
11 10 import os.path
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@
33 33 import tempfile
34 34 import unittest
35 35 import warnings
36 -from test.support import check_syntax_warning, use_old_parser
36 +from test.support import use_old_parser
37 37
38 38
39 39 TEMPLATE = r"""# coding: %s
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
1 -import contextlib
2 1 import errno
3 2 import importlib
4 3 import io
Original file line number Diff line number Diff line change
@@ -644,7 +644,6 @@
644 644 """
645 645
646 646 import re
647 -import sys
648 647 import unittest
649 648
650 649 from test import support
Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@
4 4 import io
5 5 import os
6 6 import pathlib
7 -import signal
8 7 import sys
9 8 import re
10 9 import warnings
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
1 -import itertools
2 1 import textwrap
3 2 import unittest
4 3 import sys
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
1 1 """Tests for the lll script in the Tools/script directory."""
2 2
3 3 import os
4 -import sys
5 4 import tempfile
6 5 from test import support
7 6 from test.test_tools import skip_if_missing, import_tool
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
3 3 import sys
4 4 import unittest
5 5 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
7 7
8 8
9 9 # need Tools/script/ directory: skip if run on Python installed on the system
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
3 3 import pickle
4 4 import re
5 5 import sys
6 -from unittest import TestCase, main, skipUnless, SkipTest, skip
6 +from unittest import TestCase, main, skipUnless, skip
7 7 from copy import copy, deepcopy
8 8
9 9 from typing import Any, NoReturn
Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@
6 6 import random
7 7 import tokenize
8 8 import ast
9 -import sys
10 9
11 10
12 11 def read_pyfile(filename):
Original file line number Diff line number Diff line change
@@ -6,8 +6,6 @@
6 6 import io
7 7 import os
8 8 import pickle
9 -import shutil
10 -import subprocess
11 9 import sys
12 10 import weakref
13 11 from unittest import mock