Merged revisions 78093 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78093 | georg.brandl | 2010-02-07 18:03:15 +0100 (So, 07 Feb 2010) | 1 line

  Remove unused imports in test modules.
........
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index d4f40aa..a9db105 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -146,7 +146,6 @@
 """
 
 import getopt
-import itertools
 import json
 import os
 import random
@@ -509,8 +508,8 @@
 
     if use_mp:
         from threading import Thread
-        from queue import Queue, Empty
-        from subprocess import Popen, PIPE, STDOUT
+        from queue import Queue
+        from subprocess import Popen, PIPE
         from collections import deque
         debug_output_pat = re.compile(r"\[\d+ refs\]$")
         pending = deque()
diff --git a/Lib/test/test__locale.py b/Lib/test/test__locale.py
index 54ac6aa..cbb97fe 100644
--- a/Lib/test/test__locale.py
+++ b/Lib/test/test__locale.py
@@ -1,4 +1,4 @@
-from test.support import verbose, run_unittest
+from test.support import run_unittest
 from _locale import (setlocale, LC_ALL, LC_CTYPE, LC_NUMERIC, localeconv, Error)
 try:
     from _locale import (RADIXCHAR, THOUSEP, nl_langinfo)
diff --git a/Lib/test/test_abstract_numbers.py b/Lib/test/test_abstract_numbers.py
index d0164c0..2a396cd 100644
--- a/Lib/test/test_abstract_numbers.py
+++ b/Lib/test/test_abstract_numbers.py
@@ -4,7 +4,6 @@
 import operator
 import unittest
 from numbers import Complex, Real, Rational, Integral
-from numbers import Number
 from test import support
 
 class TestNumbers(unittest.TestCase):
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py
index 5d24000..c7e03df 100644
--- a/Lib/test/test_builtin.py
+++ b/Lib/test/test_builtin.py
@@ -1,12 +1,12 @@
 # Python test set -- built-in functions
 
 import platform
-import test.support, unittest
-from test.support import fcmp, TESTFN, unlink,  run_unittest, \
-                              run_with_locale
+import unittest
+from test.support import fcmp, TESTFN, unlink,  run_unittest
 from operator import neg
 
-import sys, warnings, random, collections, io, fractions
+import sys, warnings, random, collections, io
+
 warnings.filterwarnings("ignore", "hex../oct.. of negative int",
                         FutureWarning, __name__)
 warnings.filterwarnings("ignore", "integer argument expected",
diff --git a/Lib/test/test_cmath.py b/Lib/test/test_cmath.py
index d60d2f0..e6c80d2 100644
--- a/Lib/test/test_cmath.py
+++ b/Lib/test/test_cmath.py
@@ -1,7 +1,6 @@
 from test.support import run_unittest
 from test.test_math import parse_testfile, test_file
 import unittest
-import os, sys
 import cmath, math
 from cmath import phase, polar, rect, pi
 
diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py
index b03a0ba..d68a5db 100644
--- a/Lib/test/test_cmd_line.py
+++ b/Lib/test/test_cmd_line.py
@@ -2,7 +2,6 @@
 # All tests are executed with environment variables ignored
 # See test_cmd_line_script.py for testing of script execution
 
-import os
 import test.support, unittest
 import os
 import sys
diff --git a/Lib/test/test_cmd_line_script.py b/Lib/test/test_cmd_line_script.py
index bb3a74f..f7c27a7 100644
--- a/Lib/test/test_cmd_line_script.py
+++ b/Lib/test/test_cmd_line_script.py
@@ -3,9 +3,8 @@
 import unittest
 import os
 import os.path
-import sys
 import test.support
-from test.script_helper import (spawn_python, kill_python, run_python,
+from test.script_helper import (run_python,
                                 temp_dir, make_script, compile_script,
                                 make_pkg, make_zip_script, make_zip_pkg)
 
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py
index 067c537..797b350 100644
--- a/Lib/test/test_collections.py
+++ b/Lib/test/test_collections.py
@@ -7,7 +7,6 @@
 from test import mapping_tests
 import pickle, copy
 from random import randrange, shuffle
-import operator
 import keyword
 import re
 import sys
diff --git a/Lib/test/test_compileall.py b/Lib/test/test_compileall.py
index 49b6448..1a71c5c 100644
--- a/Lib/test/test_compileall.py
+++ b/Lib/test/test_compileall.py
@@ -4,9 +4,7 @@
 import py_compile
 import shutil
 import struct
-import sys
 import tempfile
-import time
 from test import support
 import unittest
 
diff --git a/Lib/test/test_contextlib.py b/Lib/test/test_contextlib.py
index ae18085..1d3bd90 100644
--- a/Lib/test/test_contextlib.py
+++ b/Lib/test/test_contextlib.py
@@ -1,9 +1,7 @@
 """Unit tests for contextlib.py, and other context managers."""
 
 
-import sys
 import os
-import decimal
 import sys
 import tempfile
 import unittest
diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py
index d303598..dada733 100644
--- a/Lib/test/test_decimal.py
+++ b/Lib/test/test_decimal.py
@@ -24,7 +24,6 @@
 with the corresponding argument.
 """
 
-import glob
 import math
 import os, sys
 import pickle, copy
diff --git a/Lib/test/test_deque.py b/Lib/test/test_deque.py
index 874c343..a2f5fae 100644
--- a/Lib/test/test_deque.py
+++ b/Lib/test/test_deque.py
@@ -7,7 +7,6 @@
 import pickle
 from io import StringIO
 import random
-import os
 
 BIG = 100000
 
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index 95a68c0..011cb6d 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -624,7 +624,6 @@
     def test_module_subclasses(self):
         # Testing Python subclass of module...
         log = []
-        import types, sys
         MT = type(sys)
         class MM(MT):
             def __init__(self, name):
@@ -1006,7 +1005,6 @@
         # Test cyclical leaks [SF bug 519621]
         class F(object):
             __slots__ = ['a', 'b']
-        log = []
         s = F()
         s.a = [Counted(), s]
         self.assertEqual(Counted.counter, 1)
@@ -1015,7 +1013,7 @@
         self.assertEqual(Counted.counter, 0)
 
         # Test lookup leaks [SF bug 572567]
-        import sys,gc
+        import gc
         if hasattr(gc, 'get_objects'):
             class G(object):
                 def __eq__(self, other):
@@ -2038,7 +2036,6 @@
         ## self.assertIn('__self__', dir(a.Amethod))
 
         # Try a module subclass.
-        import sys
         class M(type(sys)):
             pass
         minstance = M("m")
@@ -3206,7 +3203,6 @@
             self.fail("d.foo should be undefined now")
 
         # Test a nasty bug in recurse_down_subclasses()
-        import gc
         class A(object):
             pass
         class B(A):
@@ -3996,7 +3992,6 @@
 
     def test_file_fault(self):
         # Testing sys.stdout is changed in getattr...
-        import sys
         test_stdout = sys.stdout
         class StdoutGuard:
             def __getattr__(self, attr):
@@ -4087,8 +4082,6 @@
     def test_not_implemented(self):
         # Testing NotImplemented...
         # all binary methods should be able to return a NotImplemented
-        import sys
-        import types
         import operator
 
         def specialmethod(self, other):
diff --git a/Lib/test/test_epoll.py b/Lib/test/test_epoll.py
index 847b991..04140ef 100644
--- a/Lib/test/test_epoll.py
+++ b/Lib/test/test_epoll.py
@@ -21,12 +21,10 @@
 """
 Tests for epoll wrapper.
 """
-import os
 import socket
 import errno
 import time
 import select
-import tempfile
 import unittest
 
 from test import support
diff --git a/Lib/test/test_file.py b/Lib/test/test_file.py
index fa867e0..5034a5b 100644
--- a/Lib/test/test_file.py
+++ b/Lib/test/test_file.py
@@ -7,7 +7,7 @@
 import io
 import _pyio as pyio
 
-from test.support import TESTFN, findfile, run_unittest
+from test.support import TESTFN, run_unittest
 from collections import UserList
 
 class AutoFileTests(unittest.TestCase):
diff --git a/Lib/test/test_filecmp.py b/Lib/test/test_filecmp.py
index c71a27a..9b5725d 100644
--- a/Lib/test/test_filecmp.py
+++ b/Lib/test/test_filecmp.py
@@ -1,5 +1,5 @@
 
-import os, filecmp, shutil, tempfile, shutil
+import os, filecmp, shutil, tempfile
 import unittest
 from test import support
 
diff --git a/Lib/test/test_fileio.py b/Lib/test/test_fileio.py
index fd27512..1493c6f 100644
--- a/Lib/test/test_fileio.py
+++ b/Lib/test/test_fileio.py
@@ -8,9 +8,7 @@
 from weakref import proxy
 from functools import wraps
 
-from test.support import (TESTFN, findfile, check_warnings, run_unittest,
-                          make_bad_fd)
-from collections import UserList
+from test.support import TESTFN, check_warnings, run_unittest, make_bad_fd
 
 from _io import FileIO as _FileIO
 
diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py
index c3d6cbf..cabeb16 100644
--- a/Lib/test/test_float.py
+++ b/Lib/test/test_float.py
@@ -546,7 +546,6 @@
 
     if float.__getformat__("double").startswith("IEEE"):
         def test_negative_zero(self):
-            import math
             def pos_pos():
                 return 0.0, math.atan2(0.0, -1)
             def pos_neg():
diff --git a/Lib/test/test_fork1.py b/Lib/test/test_fork1.py
index 88f9fe9..74cd0c0 100644
--- a/Lib/test/test_fork1.py
+++ b/Lib/test/test_fork1.py
@@ -1,7 +1,6 @@
 """This test checks for correct fork() behavior.
 """
 
-import errno
 import imp
 import os
 import signal
diff --git a/Lib/test/test_frozen.py b/Lib/test/test_frozen.py
index ab7b52f..79cc1c3 100644
--- a/Lib/test/test_frozen.py
+++ b/Lib/test/test_frozen.py
@@ -2,7 +2,7 @@
 
 from test.support import captured_stdout, run_unittest
 import unittest
-import sys, os
+import sys
 
 class FrozenTests(unittest.TestCase):
     def test_frozen(self):
diff --git a/Lib/test/test_getopt.py b/Lib/test/test_getopt.py
index 20b5690..13e1980 100644
--- a/Lib/test/test_getopt.py
+++ b/Lib/test/test_getopt.py
@@ -5,7 +5,6 @@
 import unittest
 
 import getopt
-import os
 
 sentinel = object()
 
diff --git a/Lib/test/test_hashlib.py b/Lib/test/test_hashlib.py
index e1a1bd3..44eed78 100644
--- a/Lib/test/test_hashlib.py
+++ b/Lib/test/test_hashlib.py
@@ -8,7 +8,6 @@
 
 import array
 import hashlib
-from io import StringIO
 import itertools
 import sys
 try:
diff --git a/Lib/test/test_heapq.py b/Lib/test/test_heapq.py
index 5e3b0ee..3295869 100644
--- a/Lib/test/test_heapq.py
+++ b/Lib/test/test_heapq.py
@@ -370,8 +370,6 @@
 
 
 def test_main(verbose=None):
-    from types import BuiltinFunctionType
-
     test_classes = [TestHeapPython, TestHeapC, TestErrorHandling]
     support.run_unittest(*test_classes)
 
diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py
index fb5cf82..e3d51a9 100644
--- a/Lib/test/test_imaplib.py
+++ b/Lib/test/test_imaplib.py
@@ -7,10 +7,7 @@
 from contextlib import contextmanager
 import imaplib
 import os.path
-import select
-import socket
 import socketserver
-import sys
 import time
 
 from test.support import reap_threads, verbose
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py
index ede793a..35fd775 100644
--- a/Lib/test/test_inspect.py
+++ b/Lib/test/test_inspect.py
@@ -6,7 +6,7 @@
 import collections
 from os.path import normcase
 
-from test.support import TESTFN, run_unittest
+from test.support import run_unittest
 
 from test import inspect_fodder as mod
 from test import inspect_fodder2 as mod2
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
index fe1a2b8..1b2d491 100644
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -28,9 +28,8 @@
 import unittest
 import warnings
 import weakref
-import gc
 import abc
-from itertools import chain, cycle, count
+from itertools import cycle, count
 from collections import deque
 from test import support
 
diff --git a/Lib/test/test_long.py b/Lib/test/test_long.py
index 3c6b215..eea67e6 100644
--- a/Lib/test/test_long.py
+++ b/Lib/test/test_long.py
@@ -402,8 +402,6 @@
             self.assertEqual(int(float(x)), y)
 
     def test_float_overflow(self):
-        import math
-
         for x in -2.0, -1.0, 0.0, 1.0, 2.0:
             self.assertEqual(float(int(x)), x)
 
@@ -435,8 +433,6 @@
             "float(shuge) should not equal int(shuge)")
 
     def test_logs(self):
-        import math
-
         LOG10E = math.log10(math.e)
 
         for exp in list(range(10)) + [100, 1000, 10000]:
@@ -456,7 +452,6 @@
 
     def test_mixed_compares(self):
         eq = self.assertEqual
-        import math
 
         # We're mostly concerned with that mixing floats and longs does the
         # right stuff, even when longs are too large to fit in a float.
diff --git a/Lib/test/test_memoryio.py b/Lib/test/test_memoryio.py
index ecb6ab8..1e7d351 100644
--- a/Lib/test/test_memoryio.py
+++ b/Lib/test/test_memoryio.py
@@ -8,7 +8,6 @@
 
 import io
 import _pyio as pyio
-import sys
 import pickle
 
 class MemorySeekTestMixin:
diff --git a/Lib/test/test_multibytecodec.py b/Lib/test/test_multibytecodec.py
index ce860d7..849573a 100644
--- a/Lib/test/test_multibytecodec.py
+++ b/Lib/test/test_multibytecodec.py
@@ -5,7 +5,6 @@
 #
 
 from test import support
-from test import test_multibytecodec_support
 from test.support import TESTFN
 import unittest, io, codecs, sys, os
 import _multibytecodec
diff --git a/Lib/test/test_ntpath.py b/Lib/test/test_ntpath.py
index c83b45f..0fd81b6 100644
--- a/Lib/test/test_ntpath.py
+++ b/Lib/test/test_ntpath.py
@@ -1,6 +1,6 @@
 import ntpath
 import os
-from test.support import verbose, TestFailed
+from test.support import TestFailed
 from test import support, test_genericpath
 import unittest
 
diff --git a/Lib/test/test_optparse.py b/Lib/test/test_optparse.py
index e9cc2de..8486c79 100644
--- a/Lib/test/test_optparse.py
+++ b/Lib/test/test_optparse.py
@@ -16,9 +16,9 @@
 from test import support
 
 
-from optparse import make_option, Option, IndentedHelpFormatter, \
-     TitledHelpFormatter, OptionParser, OptionContainer, OptionGroup, \
-     SUPPRESS_HELP, SUPPRESS_USAGE, OptionError, OptionConflictError, \
+from optparse import make_option, Option, \
+     TitledHelpFormatter, OptionParser, OptionGroup, \
+     SUPPRESS_USAGE, OptionError, OptionConflictError, \
      BadOptionError, OptionValueError, Values
 from optparse import _match_abbrev
 from optparse import _parse_num
@@ -1224,7 +1224,6 @@
 
     def variable_args(self, option, opt, value, parser):
         self.assertTrue(value is None)
-        done = 0
         value = []
         rargs = parser.rargs
         while rargs:
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index 6155f0a..395402b 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -154,7 +154,6 @@
         self.assertTrue(s == "foobar")
 
     def test_tmpnam(self):
-        import sys
         if not hasattr(os, "tmpnam"):
             return
         warnings.filterwarnings("ignore", "tmpnam", RuntimeWarning,
@@ -215,8 +214,6 @@
         self.assertEquals(result[stat.ST_SIZE], 3)
         self.assertEquals(result.st_size, 3)
 
-        import sys
-
         # Make sure all the attributes are there
         members = dir(result)
         for name in dir(stat):
diff --git a/Lib/test/test_parser.py b/Lib/test/test_parser.py
index 9948bd6..a36b544 100644
--- a/Lib/test/test_parser.py
+++ b/Lib/test/test_parser.py
@@ -1,5 +1,4 @@
 import parser
-import os
 import unittest
 import sys
 import operator
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
index 5d52707..7af903d 100644
--- a/Lib/test/test_pdb.py
+++ b/Lib/test/test_pdb.py
@@ -2,10 +2,7 @@
 # specified test modules (RFE #5142).
 
 import imp
-import os
 import sys
-import doctest
-import tempfile
 
 from test import support
 # This little helper class is essential for testing pdb under doctest.
diff --git a/Lib/test/test_print.py b/Lib/test/test_print.py
index f157bc7..ad71462 100644
--- a/Lib/test/test_print.py
+++ b/Lib/test/test_print.py
@@ -8,7 +8,6 @@
 import unittest
 from test import support
 
-import sys
 try:
     # 3.x
     from io import StringIO
diff --git a/Lib/test/test_profile.py b/Lib/test/test_profile.py
index 699fe4a..cd7ec58 100644
--- a/Lib/test/test_profile.py
+++ b/Lib/test/test_profile.py
@@ -1,6 +1,5 @@
 """Test suite for the profile module."""
 
-import os
 import sys
 import pstats
 import unittest
diff --git a/Lib/test/test_pyexpat.py b/Lib/test/test_pyexpat.py
index 5ac2a47..00d92f9 100644
--- a/Lib/test/test_pyexpat.py
+++ b/Lib/test/test_pyexpat.py
@@ -5,7 +5,6 @@
 import sys
 import unittest
 
-import pyexpat
 from xml.parsers import expat
 
 from test.support import sortdict, run_unittest
diff --git a/Lib/test/test_queue.py b/Lib/test/test_queue.py
index 95f80ac..6ee78dd 100644
--- a/Lib/test/test_queue.py
+++ b/Lib/test/test_queue.py
@@ -1,7 +1,6 @@
 # Some simple queue module tests, plus some failure conditions
 # to ensure the Queue locks remain stable.
 import queue
-import sys
 import threading
 import time
 import unittest
diff --git a/Lib/test/test_random.py b/Lib/test/test_random.py
index c59e4fa..10406fe 100644
--- a/Lib/test/test_random.py
+++ b/Lib/test/test_random.py
@@ -5,7 +5,7 @@
 import time
 import pickle
 import warnings
-from math import log, exp, sqrt, pi, fsum, sin
+from math import log, exp, pi, fsum, sin
 from test import support
 
 class TestBasicOps(unittest.TestCase):
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py
index 5eb9405..7b0a8dd 100644
--- a/Lib/test/test_re.py
+++ b/Lib/test/test_re.py
@@ -1,7 +1,7 @@
 from test.support import verbose, run_unittest
 import re
 from re import Scanner
-import sys, os, traceback
+import sys, traceback
 from weakref import proxy
 
 # Misc tests from Tim Peters' re.doc
@@ -748,7 +748,7 @@
         self.assertRaises(TypeError, _sre.compile, {}, 0, [])
 
 def run_re_tests():
-    from test.re_tests import benchmarks, tests, SUCCEED, FAIL, SYNTAX_ERROR
+    from test.re_tests import tests, SUCCEED, FAIL, SYNTAX_ERROR
     if verbose:
         print('Running re_tests test suite')
     else:
diff --git a/Lib/test/test_set.py b/Lib/test/test_set.py
index 194bbff..f4d1f6a 100644
--- a/Lib/test/test_set.py
+++ b/Lib/test/test_set.py
@@ -5,7 +5,6 @@
 import operator
 import copy
 import pickle
-import os
 from random import randrange, shuffle
 import sys
 import warnings
diff --git a/Lib/test/test_socketserver.py b/Lib/test/test_socketserver.py
index ce6e1f0..a38e0fd 100644
--- a/Lib/test/test_socketserver.py
+++ b/Lib/test/test_socketserver.py
@@ -3,7 +3,6 @@
 """
 
 import contextlib
-import errno
 import imp
 import os
 import select
@@ -11,13 +10,11 @@
 import socket
 import tempfile
 import threading
-import time
 import unittest
 import socketserver
 
 import test.support
 from test.support import reap_children, reap_threads, verbose
-from test.support import TESTFN as TEST_FILE
 
 test.support.requires("network")
 
diff --git a/Lib/test/test_sqlite.py b/Lib/test/test_sqlite.py
index ec6f634..d82b0a9 100644
--- a/Lib/test/test_sqlite.py
+++ b/Lib/test/test_sqlite.py
@@ -1,4 +1,3 @@
-import unittest
 from test.support import run_unittest, import_module
 
 # Skip test if _sqlite3 module not installed
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index 3467e3a..8d6d742 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -5,13 +5,10 @@
 from test import support
 import socket
 import select
-import errno
-import subprocess
 import time
 import os
 import pprint
 import urllib.parse, urllib.request
-import shutil
 import traceback
 import asyncore
 
diff --git a/Lib/test/test_strftime.py b/Lib/test/test_strftime.py
index 7128fd7..41144b7 100644
--- a/Lib/test/test_strftime.py
+++ b/Lib/test/test_strftime.py
@@ -4,7 +4,6 @@
 
 import calendar
 import sys
-import os
 import re
 from test import support
 import time
diff --git a/Lib/test/test_structmembers.py b/Lib/test/test_structmembers.py
index 27db161..013c50a 100644
--- a/Lib/test/test_structmembers.py
+++ b/Lib/test/test_structmembers.py
@@ -6,7 +6,7 @@
     LLONG_MAX, LLONG_MIN, ULLONG_MAX, \
     PY_SSIZE_T_MAX, PY_SSIZE_T_MIN
 
-import warnings, unittest, sys
+import unittest
 from test import support
 
 ts=test_structmembersType(False,  # T_BOOL
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index eb0bef8..516fa15 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -461,7 +461,7 @@
         sys._clear_type_cache()
 
     def test_ioencoding(self):
-        import subprocess,os
+        import subprocess
         env = dict(os.environ)
 
         # Test character: cent sign, encoded as 0x4A (ASCII J) in CP424,
diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py
index 614dffc..5eff318 100644
--- a/Lib/test/test_sysconfig.py
+++ b/Lib/test/test_sysconfig.py
@@ -6,7 +6,6 @@
 """
 import unittest
 import sys
-import test
 import os
 import subprocess
 import shutil
diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py
index 12cf2fb..89a2583 100644
--- a/Lib/test/test_tarfile.py
+++ b/Lib/test/test_tarfile.py
@@ -2,7 +2,6 @@
 import os
 import io
 import shutil
-import tempfile
 import io
 from hashlib import md5
 import errno
diff --git a/Lib/test/test_tempfile.py b/Lib/test/test_tempfile.py
index 5b6a420..0dd8fc4 100644
--- a/Lib/test/test_tempfile.py
+++ b/Lib/test/test_tempfile.py
@@ -3,7 +3,6 @@
 import os
 import sys
 import re
-import errno
 import warnings
 
 import unittest
diff --git a/Lib/test/test_ttk_guionly.py b/Lib/test/test_ttk_guionly.py
index 4e43a18..eca8bcf 100644
--- a/Lib/test/test_ttk_guionly.py
+++ b/Lib/test/test_ttk_guionly.py
@@ -1,5 +1,4 @@
 import os
-import sys
 import unittest
 from test import support
 
diff --git a/Lib/test/test_ttk_textonly.py b/Lib/test/test_ttk_textonly.py
index b99625a..566fc9d 100644
--- a/Lib/test/test_ttk_textonly.py
+++ b/Lib/test/test_ttk_textonly.py
@@ -1,5 +1,4 @@
 import os
-import sys
 from test import support
 
 # Skip this test if _tkinter does not exist.
diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py
index d58c073..d82c846 100644
--- a/Lib/test/test_types.py
+++ b/Lib/test/test_types.py
@@ -18,7 +18,6 @@
         if not {'x': 1}: self.fail('{\'x\': 1} is false instead of true')
         def f(): pass
         class C: pass
-        import sys
         x = C()
         if not f: self.fail('f is false instead of true')
         if not C: self.fail('C is false instead of true')
diff --git a/Lib/test/test_urllib2net.py b/Lib/test/test_urllib2net.py
index b933194..10bbd3a 100644
--- a/Lib/test/test_urllib2net.py
+++ b/Lib/test/test_urllib2net.py
@@ -6,7 +6,6 @@
 
 import os
 import socket
-import sys
 import urllib.error
 import urllib.request
 
@@ -75,8 +74,6 @@
 class CloseSocketTest(unittest.TestCase):
 
     def test_close(self):
-        import socket, http.client, gc
-
         # calling .close() on urllib2's response objects should close the
         # underlying socket
 
@@ -150,7 +147,6 @@
 ##             self._test_urls(urls, self._extra_handlers()+[bauth, dauth])
 
     def _test_urls(self, urls, handlers, retry=True):
-        import socket
         import time
         import logging
         debug = logging.getLogger("test_urllib2").debug
diff --git a/Lib/test/test_zipimport_support.py b/Lib/test/test_zipimport_support.py
index a868ced..27e0bf8 100644
--- a/Lib/test/test_zipimport_support.py
+++ b/Lib/test/test_zipimport_support.py
@@ -2,7 +2,6 @@
 # for working with modules located inside zipfiles
 # The tests are centralised in this fashion to make it easy to drop them
 # if a platform doesn't support zipimport
-import unittest
 import test.support
 import os
 import os.path
@@ -15,8 +14,7 @@
 import linecache
 import pdb
 from test.script_helper import (spawn_python, kill_python, run_python,
-                                temp_dir, make_script, compile_script,
-                                make_pkg, make_zip_script, make_zip_pkg)
+                                temp_dir, make_script, make_zip_script)
 
 verbose = test.support.verbose