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

Victor Stinner webhook-mailer at python.org
Wed Apr 29 20:21:37 EDT 2020


https://github.com/python/cpython/commit/b1e11c31c523dc082985e9de779ceeb47224e536
commit: b1e11c31c523dc082985e9de779ceeb47224e536
branch: master
author: Victor Stinner <vstinner at python.org>
committer: GitHub <noreply at github.com>
date: 2020-04-30T02:21:30+02:00
summary:

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

files:
M Lib/distutils/tests/test_build_clib.py
M Lib/distutils/tests/test_config_cmd.py
M Lib/distutils/tests/test_dist.py
M Lib/distutils/tests/test_spawn.py
M Lib/test/test_array.py
M Lib/test/test_asyncio/test_base_events.py
M Lib/test/test_asyncio/test_server.py
M Lib/test/test_asyncio/test_sslproto.py
M Lib/test/test_call.py
M Lib/test/test_code.py
M Lib/test/test_compileall.py
M Lib/test/test_flufl.py
M Lib/test/test_fractions.py
M Lib/test/test_fstring.py
M Lib/test/test_hashlib.py
M Lib/test/test_ipaddress.py
M Lib/test/test_logging.py
M Lib/test/test_named_expressions.py

diff --git a/Lib/distutils/tests/test_build_clib.py b/Lib/distutils/tests/test_build_clib.py
index 85d09906f228d..abd8313770ef7 100644
--- a/Lib/distutils/tests/test_build_clib.py
+++ b/Lib/distutils/tests/test_build_clib.py
@@ -8,7 +8,6 @@
 from distutils.command.build_clib import build_clib
 from distutils.errors import DistutilsSetupError
 from distutils.tests import support
-from distutils.spawn import find_executable
 
 class BuildCLibTestCase(support.TempdirManager,
                         support.LoggingSilencer,
diff --git a/Lib/distutils/tests/test_config_cmd.py b/Lib/distutils/tests/test_config_cmd.py
index 8bd2c94237846..9aeab07b46836 100644
--- a/Lib/distutils/tests/test_config_cmd.py
+++ b/Lib/distutils/tests/test_config_cmd.py
@@ -39,7 +39,6 @@ def test_dump_file(self):
 
     @unittest.skipIf(sys.platform == 'win32', "can't test on Windows")
     def test_search_cpp(self):
-        import shutil
         cmd = missing_compiler_executable(['preprocessor'])
         if cmd is not None:
             self.skipTest('The %r command is not found' % cmd)
diff --git a/Lib/distutils/tests/test_dist.py b/Lib/distutils/tests/test_dist.py
index cc34725a99efa..60956dadef234 100644
--- a/Lib/distutils/tests/test_dist.py
+++ b/Lib/distutils/tests/test_dist.py
@@ -8,7 +8,7 @@
 
 from unittest import mock
 
-from distutils.dist import Distribution, fix_help_options, DistributionMetadata
+from distutils.dist import Distribution, fix_help_options
 from distutils.cmd import Command
 
 from test.support import (
diff --git a/Lib/distutils/tests/test_spawn.py b/Lib/distutils/tests/test_spawn.py
index 73b0f5cb7324c..cf1faad5f4dd5 100644
--- a/Lib/distutils/tests/test_spawn.py
+++ b/Lib/distutils/tests/test_spawn.py
@@ -2,8 +2,7 @@
 import os
 import stat
 import sys
-import unittest
-from unittest import mock
+import unittest.mock
 from test.support import run_unittest, unix_shell
 from test import support as test_support
 
diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py
index 5f612fba8a497..f731b70415e7f 100644
--- a/Lib/test/test_array.py
+++ b/Lib/test/test_array.py
@@ -10,7 +10,6 @@
 import operator
 import struct
 import sys
-import warnings
 
 import array
 from array import _array_reconstructor as array_reconstructor
diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py
index 4adcbf46cc9eb..533d5cc7f5038 100644
--- a/Lib/test/test_asyncio/test_base_events.py
+++ b/Lib/test/test_asyncio/test_base_events.py
@@ -3,7 +3,6 @@
 import concurrent.futures
 import errno
 import math
-import os
 import socket
 import sys
 import threading
diff --git a/Lib/test/test_asyncio/test_server.py b/Lib/test/test_asyncio/test_server.py
index 006ead29562cf..2de4dcad17c8e 100644
--- a/Lib/test/test_asyncio/test_server.py
+++ b/Lib/test/test_asyncio/test_server.py
@@ -3,7 +3,6 @@
 import threading
 import unittest
 
-from test import support
 from test.support import socket_helper
 from test.test_asyncio import utils as test_utils
 from test.test_asyncio import functional as func_tests
diff --git a/Lib/test/test_asyncio/test_sslproto.py b/Lib/test/test_asyncio/test_sslproto.py
index c716eacfaf1c0..948820c82f3bf 100644
--- a/Lib/test/test_asyncio/test_sslproto.py
+++ b/Lib/test/test_asyncio/test_sslproto.py
@@ -2,7 +2,6 @@
 
 import logging
 import socket
-import sys
 from test import support
 import unittest
 import weakref
diff --git a/Lib/test/test_call.py b/Lib/test/test_call.py
index b3077ad1d1cb8..451a7170c304d 100644
--- a/Lib/test/test_call.py
+++ b/Lib/test/test_call.py
@@ -1,4 +1,3 @@
-import datetime
 import unittest
 from test.support import cpython_only
 try:
diff --git a/Lib/test/test_code.py b/Lib/test/test_code.py
index 7bb824ea31dac..ac3dde745603d 100644
--- a/Lib/test/test_code.py
+++ b/Lib/test/test_code.py
@@ -130,7 +130,6 @@
 import threading
 import unittest
 import weakref
-import opcode
 try:
     import ctypes
 except ImportError:
diff --git a/Lib/test/test_compileall.py b/Lib/test/test_compileall.py
index cb59fd71b3825..72678945089f2 100644
--- a/Lib/test/test_compileall.py
+++ b/Lib/test/test_compileall.py
@@ -11,7 +11,6 @@
 import time
 import unittest
 import io
-import errno
 
 from unittest import mock, skipUnless
 try:
diff --git a/Lib/test/test_flufl.py b/Lib/test/test_flufl.py
index b71442804c72b..22285859a92bb 100644
--- a/Lib/test/test_flufl.py
+++ b/Lib/test/test_flufl.py
@@ -1,6 +1,5 @@
 import __future__
 import unittest
-import sys
 from test import support
 
 
diff --git a/Lib/test/test_fractions.py b/Lib/test/test_fractions.py
index c748533c79129..0845f7921c39e 100644
--- a/Lib/test/test_fractions.py
+++ b/Lib/test/test_fractions.py
@@ -9,7 +9,6 @@
 import functools
 import sys
 import unittest
-import warnings
 from copy import copy, deepcopy
 from pickle import dumps, loads
 F = fractions.Fraction
diff --git a/Lib/test/test_fstring.py b/Lib/test/test_fstring.py
index 4c240f34a3543..fe465b7e1d43d 100644
--- a/Lib/test/test_fstring.py
+++ b/Lib/test/test_fstring.py
@@ -10,9 +10,7 @@
 import ast
 import types
 import decimal
-import sys
 import unittest
-from test import support
 
 a_global = 'global variable'
 
diff --git a/Lib/test/test_hashlib.py b/Lib/test/test_hashlib.py
index 31d8e5567639c..f9fe7e37920a3 100644
--- a/Lib/test/test_hashlib.py
+++ b/Lib/test/test_hashlib.py
@@ -8,7 +8,6 @@
 
 import array
 from binascii import unhexlify
-import functools
 import hashlib
 import importlib
 import itertools
diff --git a/Lib/test/test_ipaddress.py b/Lib/test/test_ipaddress.py
index bbb3fc89da653..6d5814c9774a0 100644
--- a/Lib/test/test_ipaddress.py
+++ b/Lib/test/test_ipaddress.py
@@ -7,7 +7,6 @@
 import unittest
 import re
 import contextlib
-import functools
 import operator
 import pickle
 import ipaddress
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index e1d0eb8145fe2..4cc45f7107115 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -36,7 +36,6 @@
 import queue
 import random
 import re
-import signal
 import socket
 import struct
 import sys
diff --git a/Lib/test/test_named_expressions.py b/Lib/test/test_named_expressions.py
index 3ae557f78d273..c813830ce6d3c 100644
--- a/Lib/test/test_named_expressions.py
+++ b/Lib/test/test_named_expressions.py
@@ -1,4 +1,3 @@
-import os
 import unittest
 
 GLOBAL_VAR = None



More information about the Python-checkins mailing list