[Python-checkins] bpo-40443: Remove unused imports in tests (GH-19805)

Victor Stinner webhook-mailer at python.org
Wed Apr 29 19:48:47 EDT 2020


https://github.com/python/cpython/commit/57572b103ebd8732ac21922f0051a7f140d0e405
commit: 57572b103ebd8732ac21922f0051a7f140d0e405
branch: master
author: Victor Stinner <vstinner at python.org>
committer: GitHub <noreply at github.com>
date: 2020-04-30T01:48:37+02:00
summary:

bpo-40443: Remove unused imports in tests (GH-19805)

files:
M Lib/test/test_parser.py
M Lib/test/test_peg_parser.py
M Lib/test/test_platform.py
M Lib/test/test_positional_only_arg.py
M Lib/test/test_pstats.py
M Lib/test/test_re.py
M Lib/test/test_regrtest.py
M Lib/test/test_string_literals.py
M Lib/test/test_support.py
M Lib/test/test_syntax.py
M Lib/test/test_tempfile.py
M Lib/test/test_tools/test_c_analyzer/test_parser/test_preprocessor.py
M Lib/test/test_tools/test_lll.py
M Lib/test/test_tools/test_pathfix.py
M Lib/test/test_typing.py
M Lib/test/test_unparse.py
M Lib/test/test_uuid.py

diff --git a/Lib/test/test_parser.py b/Lib/test/test_parser.py
index fd33d6529b144..a4d2cdc090aa2 100644
--- a/Lib/test/test_parser.py
+++ b/Lib/test/test_parser.py
@@ -8,7 +8,6 @@
 import unittest
 import operator
 import struct
-import sys
 from test import support
 from test.support.script_helper import assert_python_failure
 from test.support.script_helper import assert_python_ok
diff --git a/Lib/test/test_peg_parser.py b/Lib/test/test_peg_parser.py
index 43d30bae84984..191494481eb0a 100644
--- a/Lib/test/test_peg_parser.py
+++ b/Lib/test/test_peg_parser.py
@@ -1,9 +1,6 @@
 import ast
-import os
-import sys
 import _peg_parser as peg_parser
 import unittest
-from pathlib import PurePath
 from typing import Any, Union, Iterable, Tuple
 from textwrap import dedent
 from test import support
diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py
index 998f1e0dc315a..7664b38a720a7 100644
--- a/Lib/test/test_platform.py
+++ b/Lib/test/test_platform.py
@@ -3,7 +3,6 @@
 import subprocess
 import sys
 import unittest
-import collections
 from unittest import mock
 
 from test import support
diff --git a/Lib/test/test_positional_only_arg.py b/Lib/test/test_positional_only_arg.py
index 4d5fb6bc6112c..f7bd401804364 100644
--- a/Lib/test/test_positional_only_arg.py
+++ b/Lib/test/test_positional_only_arg.py
@@ -3,7 +3,6 @@
 import dis
 import pickle
 import unittest
-import sys
 
 from test.support import check_syntax_error, use_old_parser
 
diff --git a/Lib/test/test_pstats.py b/Lib/test/test_pstats.py
index f3a6e586c3bcc..10559deb6bcb2 100644
--- a/Lib/test/test_pstats.py
+++ b/Lib/test/test_pstats.py
@@ -5,7 +5,6 @@
 from pstats import SortKey
 
 import pstats
-import time
 import cProfile
 
 class AddCallersTestCase(unittest.TestCase):
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py
index 4817d761a22df..1bfbcb853c4ed 100644
--- a/Lib/test/test_re.py
+++ b/Lib/test/test_re.py
@@ -2217,7 +2217,7 @@ def test_re_benchmarks(self):
 
     def test_re_tests(self):
         're_tests test suite'
-        from test.re_tests import tests, SUCCEED, FAIL, SYNTAX_ERROR
+        from test.re_tests import tests, FAIL, SYNTAX_ERROR
         for t in tests:
             pattern = s = outcome = repl = expected = None
             if len(t) == 5:
diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py
index 93f8d44ec6938..de209da41a34d 100644
--- a/Lib/test/test_regrtest.py
+++ b/Lib/test/test_regrtest.py
@@ -5,7 +5,6 @@
 """
 
 import contextlib
-import faulthandler
 import glob
 import io
 import os.path
diff --git a/Lib/test/test_string_literals.py b/Lib/test/test_string_literals.py
index 5a2fb8b372f8c..5b5477d14d467 100644
--- a/Lib/test/test_string_literals.py
+++ b/Lib/test/test_string_literals.py
@@ -33,7 +33,7 @@
 import tempfile
 import unittest
 import warnings
-from test.support import check_syntax_warning, use_old_parser
+from test.support import use_old_parser
 
 
 TEMPLATE = r"""# coding: %s
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py
index 606e57003ed71..b5a16f9cb6027 100644
--- a/Lib/test/test_support.py
+++ b/Lib/test/test_support.py
@@ -1,4 +1,3 @@
-import contextlib
 import errno
 import importlib
 import io
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py
index aff8dd72b78d4..e7468cae7b132 100644
--- a/Lib/test/test_syntax.py
+++ b/Lib/test/test_syntax.py
@@ -644,7 +644,6 @@
 """
 
 import re
-import sys
 import unittest
 
 from test import support
diff --git a/Lib/test/test_tempfile.py b/Lib/test/test_tempfile.py
index 69d5de2e1b95f..fcc706ede5aaa 100644
--- a/Lib/test/test_tempfile.py
+++ b/Lib/test/test_tempfile.py
@@ -4,7 +4,6 @@
 import io
 import os
 import pathlib
-import signal
 import sys
 import re
 import warnings
diff --git a/Lib/test/test_tools/test_c_analyzer/test_parser/test_preprocessor.py b/Lib/test/test_tools/test_c_analyzer/test_parser/test_preprocessor.py
index 56a1c9c612f72..b7f950f813976 100644
--- a/Lib/test/test_tools/test_c_analyzer/test_parser/test_preprocessor.py
+++ b/Lib/test/test_tools/test_c_analyzer/test_parser/test_preprocessor.py
@@ -1,4 +1,3 @@
-import itertools
 import textwrap
 import unittest
 import sys
diff --git a/Lib/test/test_tools/test_lll.py b/Lib/test/test_tools/test_lll.py
index b01e2188e1cf2..568cbfb5e4746 100644
--- a/Lib/test/test_tools/test_lll.py
+++ b/Lib/test/test_tools/test_lll.py
@@ -1,7 +1,6 @@
 """Tests for the lll script in the Tools/script directory."""
 
 import os
-import sys
 import tempfile
 from test import support
 from test.test_tools import skip_if_missing, import_tool
diff --git a/Lib/test/test_tools/test_pathfix.py b/Lib/test/test_tools/test_pathfix.py
index ec361178e6d81..8b4193073408b 100644
--- a/Lib/test/test_tools/test_pathfix.py
+++ b/Lib/test/test_tools/test_pathfix.py
@@ -3,7 +3,7 @@
 import sys
 import unittest
 from test import support
-from test.test_tools import import_tool, scriptsdir, skip_if_missing
+from test.test_tools import scriptsdir, skip_if_missing
 
 
 # need Tools/script/ directory: skip if run on Python installed on the system
diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py
index f191d3bb9e90c..cab8de0f5efb2 100644
--- a/Lib/test/test_typing.py
+++ b/Lib/test/test_typing.py
@@ -3,7 +3,7 @@
 import pickle
 import re
 import sys
-from unittest import TestCase, main, skipUnless, SkipTest, skip
+from unittest import TestCase, main, skipUnless, skip
 from copy import copy, deepcopy
 
 from typing import Any, NoReturn
diff --git a/Lib/test/test_unparse.py b/Lib/test/test_unparse.py
index 3bacd672d4462..b913569585a21 100644
--- a/Lib/test/test_unparse.py
+++ b/Lib/test/test_unparse.py
@@ -6,7 +6,6 @@
 import random
 import tokenize
 import ast
-import sys
 
 
 def read_pyfile(filename):
diff --git a/Lib/test/test_uuid.py b/Lib/test/test_uuid.py
index 0b267f4a97861..ac166ced38afb 100644
--- a/Lib/test/test_uuid.py
+++ b/Lib/test/test_uuid.py
@@ -6,8 +6,6 @@
 import io
 import os
 import pickle
-import shutil
-import subprocess
 import sys
 import weakref
 from unittest import mock



More information about the Python-checkins mailing list