Patch #2167 from calvin: Remove unused imports
diff --git a/Lib/test/fork_wait.py b/Lib/test/fork_wait.py
index 7eb55f6..3c75de3 100644
--- a/Lib/test/fork_wait.py
+++ b/Lib/test/fork_wait.py
@@ -13,7 +13,6 @@
 """
 
 import os, sys, time, thread, unittest
-from test.test_support import TestSkipped
 
 LONGSLEEP = 2
 SHORTSLEEP = 0.5
diff --git a/Lib/test/list_tests.py b/Lib/test/list_tests.py
index 88bc49d..b3f24d3 100644
--- a/Lib/test/list_tests.py
+++ b/Lib/test/list_tests.py
@@ -5,7 +5,6 @@
 import sys
 import os
 
-import unittest
 from test import test_support, seq_tests
 
 class CommonTest(seq_tests.CommonTest):
diff --git a/Lib/test/seq_tests.py b/Lib/test/seq_tests.py
index 2ea5094..d9b2d29 100644
--- a/Lib/test/seq_tests.py
+++ b/Lib/test/seq_tests.py
@@ -3,7 +3,6 @@
 """
 
 import unittest
-from test import test_support
 import sys
 
 # Various iterables
diff --git a/Lib/test/test_MimeWriter.py b/Lib/test/test_MimeWriter.py
index 5a20bf2..6a32cb6 100644
--- a/Lib/test/test_MimeWriter.py
+++ b/Lib/test/test_MimeWriter.py
@@ -7,7 +7,7 @@
 
 """
 
-import unittest, sys, StringIO
+import unittest, StringIO
 from test.test_support import run_unittest
 
 import warnings
diff --git a/Lib/test/test___all__.py b/Lib/test/test___all__.py
index 26ed012..571e391 100644
--- a/Lib/test/test___all__.py
+++ b/Lib/test/test___all__.py
@@ -1,5 +1,5 @@
 import unittest
-from test.test_support import verbose, run_unittest
+from test.test_support import run_unittest
 import sys
 import warnings
 
diff --git a/Lib/test/test_abc.py b/Lib/test/test_abc.py
index ac5f7ee..c53dcea 100644
--- a/Lib/test/test_abc.py
+++ b/Lib/test/test_abc.py
@@ -3,7 +3,6 @@
 
 """Unit tests for abc.py."""
 
-import sys
 import unittest
 from test import test_support
 
diff --git a/Lib/test/test_applesingle.py b/Lib/test/test_applesingle.py
index d533f1a..e915028 100644
--- a/Lib/test/test_applesingle.py
+++ b/Lib/test/test_applesingle.py
@@ -5,7 +5,6 @@
 import Carbon.File
 import MacOS
 import os
-import sys
 from test import test_support
 import struct
 import applesingle
diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py
index 0bb7e53..a54594a 100755
--- a/Lib/test/test_array.py
+++ b/Lib/test/test_array.py
@@ -6,7 +6,7 @@
 import unittest
 from test import test_support
 from weakref import proxy
-import array, cStringIO, math
+import array, cStringIO
 from cPickle import loads, dumps
 
 class ArraySubclass(array.array):
diff --git a/Lib/test/test_bsddb185.py b/Lib/test/test_bsddb185.py
index df1ece0..51e1a7e 100644
--- a/Lib/test/test_bsddb185.py
+++ b/Lib/test/test_bsddb185.py
@@ -4,7 +4,7 @@
 testing suite.
 
 """
-from test.test_support import verbose, run_unittest, findfile
+from test.test_support import run_unittest, findfile
 import unittest
 import bsddb185
 import anydbm
diff --git a/Lib/test/test_class.py b/Lib/test/test_class.py
index 9cf3331..fc61d21 100644
--- a/Lib/test/test_class.py
+++ b/Lib/test/test_class.py
@@ -1,7 +1,6 @@
 "Test the functionality of Python classes implementing operators."
 
 import unittest
-import sys
 
 from test import test_support
 
diff --git a/Lib/test/test_cmd.py b/Lib/test/test_cmd.py
index 5aa1c40..c08df0b 100644
--- a/Lib/test/test_cmd.py
+++ b/Lib/test/test_cmd.py
@@ -5,7 +5,6 @@
 """
 
 
-from test import test_support
 import cmd
 import sys
 
@@ -170,7 +169,7 @@
     from test import test_support, test_cmd
     test_support.run_doctest(test_cmd, verbose)
 
-import trace, sys,re,StringIO
+import trace, sys
 def test_coverage(coverdir):
     tracer=trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix,],
                         trace=0, count=1)
diff --git a/Lib/test/test_coercion.py b/Lib/test/test_coercion.py
index d704e4b..e3a7e43 100644
--- a/Lib/test/test_coercion.py
+++ b/Lib/test/test_coercion.py
@@ -1,5 +1,4 @@
 import copy
-import sys
 import warnings
 import unittest
 from test.test_support import run_unittest, TestFailed
diff --git a/Lib/test/test_compare.py b/Lib/test/test_compare.py
index 2fde614..13da80d 100644
--- a/Lib/test/test_compare.py
+++ b/Lib/test/test_compare.py
@@ -1,4 +1,3 @@
-import sys
 import unittest
 from test import test_support
 
diff --git a/Lib/test/test_compiler.py b/Lib/test/test_compiler.py
index 606ed70..7d5ec7c 100644
--- a/Lib/test/test_compiler.py
+++ b/Lib/test/test_compiler.py
@@ -52,7 +52,8 @@
                         compiler.compile(buf, basename, "exec")
                     except Exception, e:
                         args = list(e.args)
-                        args[0] += "[in file %s]" % basename
+                        args.append("in file %s]" % basename)
+                        #args[0] += "[in file %s]" % basename
                         e.args = tuple(args)
                         raise
 
diff --git a/Lib/test/test_copy.py b/Lib/test/test_copy.py
index ff4c987..d2899bd 100644
--- a/Lib/test/test_copy.py
+++ b/Lib/test/test_copy.py
@@ -1,6 +1,5 @@
 """Unit tests for the copy module."""
 
-import sys
 import copy
 import copy_reg
 
diff --git a/Lib/test/test_cpickle.py b/Lib/test/test_cpickle.py
index 78beda7..d6e703a 100644
--- a/Lib/test/test_cpickle.py
+++ b/Lib/test/test_cpickle.py
@@ -1,5 +1,4 @@
 import cPickle
-import unittest
 from cStringIO import StringIO
 from test.pickletester import AbstractPickleTests, AbstractPickleModuleTests
 from test import test_support
diff --git a/Lib/test/test_datetime.py b/Lib/test/test_datetime.py
index cb639b4..ee104e4 100644
--- a/Lib/test/test_datetime.py
+++ b/Lib/test/test_datetime.py
@@ -4,7 +4,6 @@
 """
 
 import os
-import sys
 import pickle
 import cPickle
 import unittest
diff --git a/Lib/test/test_dbm.py b/Lib/test/test_dbm.py
index b93e72e..4da0932 100755
--- a/Lib/test/test_dbm.py
+++ b/Lib/test/test_dbm.py
@@ -3,7 +3,6 @@
    Roger E. Masse
 """
 import os
-import random
 import dbm
 from dbm import error
 from test.test_support import verbose, verify, TestSkipped, TESTFN
diff --git a/Lib/test/test_deque.py b/Lib/test/test_deque.py
index e0ca746..b69110d 100644
--- a/Lib/test/test_deque.py
+++ b/Lib/test/test_deque.py
@@ -4,7 +4,6 @@
 from weakref import proxy
 import copy
 import cPickle as pickle
-from cStringIO import StringIO
 import random
 import os
 
diff --git a/Lib/test/test_dict.py b/Lib/test/test_dict.py
index 4ed76ea..7dd5f06 100644
--- a/Lib/test/test_dict.py
+++ b/Lib/test/test_dict.py
@@ -1,7 +1,7 @@
 import unittest
 from test import test_support
 
-import sys, UserDict, cStringIO, random, string
+import UserDict, random, string
 
 
 class DictTest(unittest.TestCase):
diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py
index d0e1c7e..fd508a9 100644
--- a/Lib/test/test_dis.py
+++ b/Lib/test/test_dis.py
@@ -1,6 +1,6 @@
 # Minimal tests for dis module
 
-from test.test_support import verbose, run_unittest
+from test.test_support import run_unittest
 import unittest
 import sys
 import dis
diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py
index 8c8786a..943fb82 100644
--- a/Lib/test/test_doctest.py
+++ b/Lib/test/test_doctest.py
@@ -2418,7 +2418,7 @@
     from test import test_doctest
     test_support.run_doctest(test_doctest, verbosity=True)
 
-import trace, sys, re, StringIO
+import trace, sys
 def test_coverage(coverdir):
     tracer = trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix,],
                          trace=0, count=1)
diff --git a/Lib/test/test_dummy_threading.py b/Lib/test/test_dummy_threading.py
index 3724f1e..dcb9729 100644
--- a/Lib/test/test_dummy_threading.py
+++ b/Lib/test/test_dummy_threading.py
@@ -3,7 +3,6 @@
 # Create a bunch of threads, let each do some work, wait until all are done
 
 from test.test_support import verbose
-import random
 import dummy_threading as _threading
 import time
 
diff --git a/Lib/test/test_email.py b/Lib/test/test_email.py
index f609968..cb4ee60 100644
--- a/Lib/test/test_email.py
+++ b/Lib/test/test_email.py
@@ -1,7 +1,6 @@
 # Copyright (C) 2001,2002 Python Software Foundation
 # email package unit tests
 
-import unittest
 # The specific tests now live in Lib/email/test
 from email.test.test_email import suite
 from test import test_support
diff --git a/Lib/test/test_email_renamed.py b/Lib/test/test_email_renamed.py
index 163e791..2c814df 100644
--- a/Lib/test/test_email_renamed.py
+++ b/Lib/test/test_email_renamed.py
@@ -1,7 +1,6 @@
 # Copyright (C) 2001-2006 Python Software Foundation
 # email package unit tests
 
-import unittest
 # The specific tests now live in Lib/email/test
 from email.test.test_email_renamed import suite
 from test import test_support
diff --git a/Lib/test/test_eof.py b/Lib/test/test_eof.py
index aae3518..4d4c03b 100644
--- a/Lib/test/test_eof.py
+++ b/Lib/test/test_eof.py
@@ -1,7 +1,6 @@
 #! /usr/bin/env python
 """test script for a few new invalid token catches"""
 
-import os
 import unittest
 from test import test_support
 
diff --git a/Lib/test/test_extcall.py b/Lib/test/test_extcall.py
index 96d1bc1..bdf8e03 100644
--- a/Lib/test/test_extcall.py
+++ b/Lib/test/test_extcall.py
@@ -1,4 +1,4 @@
-from test.test_support import verify, verbose, TestFailed, sortdict
+from test.test_support import verify, TestFailed, sortdict
 from UserList import UserList
 from UserDict import UserDict
 
diff --git a/Lib/test/test_fileinput.py b/Lib/test/test_fileinput.py
index f6589b7..9fb3ea7 100644
--- a/Lib/test/test_fileinput.py
+++ b/Lib/test/test_fileinput.py
@@ -6,7 +6,7 @@
 import unittest
 from test.test_support import verbose, TESTFN, run_unittest
 from test.test_support import unlink as safe_unlink
-import sys, os, re
+import sys, re
 from StringIO import StringIO
 from fileinput import FileInput, hook_encoded
 
diff --git a/Lib/test/test_fractions.py b/Lib/test/test_fractions.py
index 654456a..743f094 100644
--- a/Lib/test/test_fractions.py
+++ b/Lib/test/test_fractions.py
@@ -1,7 +1,7 @@
 """Tests for Lib/fractions.py."""
 
 from decimal import Decimal
-from test.test_support import run_unittest, verbose
+from test.test_support import run_unittest
 import math
 import operator
 import fractions
diff --git a/Lib/test/test_getargs2.py b/Lib/test/test_getargs2.py
index 90ca303..fa76fbc 100644
--- a/Lib/test/test_getargs2.py
+++ b/Lib/test/test_getargs2.py
@@ -1,8 +1,7 @@
 import unittest
 from test import test_support
-import sys
 
-import warnings, re
+import warnings
 warnings.filterwarnings("ignore",
                         category=DeprecationWarning,
                         message=".*integer argument expected, got float",
diff --git a/Lib/test/test_gzip.py b/Lib/test/test_gzip.py
index 124a469..1704a60 100644
--- a/Lib/test/test_gzip.py
+++ b/Lib/test/test_gzip.py
@@ -4,7 +4,7 @@
 
 import unittest
 from test import test_support
-import sys, os
+import os
 import gzip
 
 
diff --git a/Lib/test/test_htmlparser.py b/Lib/test/test_htmlparser.py
index 229bbed..810af6c 100755
--- a/Lib/test/test_htmlparser.py
+++ b/Lib/test/test_htmlparser.py
@@ -2,7 +2,6 @@
 
 import HTMLParser
 import pprint
-import sys
 import unittest
 from test import test_support
 
diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py
index 6a20c6b..d312ae5 100644
--- a/Lib/test/test_httplib.py
+++ b/Lib/test/test_httplib.py
@@ -1,6 +1,5 @@
 import httplib
 import StringIO
-import sys
 import socket
 
 from unittest import TestCase
diff --git a/Lib/test/test_imgfile.py b/Lib/test/test_imgfile.py
index bdfd796..11311c4 100755
--- a/Lib/test/test_imgfile.py
+++ b/Lib/test/test_imgfile.py
@@ -6,7 +6,7 @@
 
 from test.test_support import verbose, unlink, findfile
 
-import imgfile, uu, os
+import imgfile, uu
 
 
 def main():
diff --git a/Lib/test/test_imp.py b/Lib/test/test_imp.py
index 62b14e0..f597728 100644
--- a/Lib/test/test_imp.py
+++ b/Lib/test/test_imp.py
@@ -1,5 +1,4 @@
 import imp
-import thread
 import unittest
 from test import test_support
 
diff --git a/Lib/test/test_index.py b/Lib/test/test_index.py
index 323b37b..75f2434 100644
--- a/Lib/test/test_index.py
+++ b/Lib/test/test_index.py
@@ -1,7 +1,6 @@
 import unittest
 from test import test_support
 import operator
-import sys
 from sys import maxint
 maxsize = test_support.MAX_Py_ssize_t
 minsize = -maxsize-1
diff --git a/Lib/test/test_linuxaudiodev.py b/Lib/test/test_linuxaudiodev.py
index 5d1d1ce..303490b 100644
--- a/Lib/test/test_linuxaudiodev.py
+++ b/Lib/test/test_linuxaudiodev.py
@@ -4,13 +4,9 @@
 from test.test_support import findfile, TestSkipped, run_unittest
 
 import errno
-import fcntl
 import linuxaudiodev
-import os
 import sys
-import select
 import sunaudio
-import time
 import audioop
 import unittest
 
diff --git a/Lib/test/test_list.py b/Lib/test/test_list.py
index 3489529..37507fe 100644
--- a/Lib/test/test_list.py
+++ b/Lib/test/test_list.py
@@ -1,4 +1,3 @@
-import unittest
 import sys
 from test import test_support, list_tests
 
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index 1ed6cb2..5a96664 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -1858,8 +1858,8 @@
 <BLANKLINE>
 """
 import select
-import os, sys, string, struct, types, cPickle, cStringIO
-import socket, tempfile, threading, time
+import os, sys, string, struct, cPickle, cStringIO
+import socket, threading
 import logging, logging.handlers, logging.config, test.test_support
 
 
diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py
index fcc4c8f..97bca2c 100644
--- a/Lib/test/test_minidom.py
+++ b/Lib/test/test_minidom.py
@@ -3,7 +3,6 @@
 import os
 import sys
 import pickle
-import traceback
 from StringIO import StringIO
 from test.test_support import verbose, run_unittest, TestSkipped
 import unittest
diff --git a/Lib/test/test_module.py b/Lib/test/test_module.py
index cc8b192..e0c7ec3 100644
--- a/Lib/test/test_module.py
+++ b/Lib/test/test_module.py
@@ -1,6 +1,6 @@
 # Test the module type
 import unittest
-from test.test_support import verbose, run_unittest
+from test.test_support import run_unittest
 
 import sys
 ModuleType = type(sys)
diff --git a/Lib/test/test_modulefinder.py b/Lib/test/test_modulefinder.py
index 18cc322..b62758a 100644
--- a/Lib/test/test_modulefinder.py
+++ b/Lib/test/test_modulefinder.py
@@ -1,5 +1,5 @@
 import __future__
-import sys, os
+import os
 import unittest
 import distutils.dir_util
 import tempfile
diff --git a/Lib/test/test_multibytecodec_support.py b/Lib/test/test_multibytecodec_support.py
index 57a4751..6055764 100644
--- a/Lib/test/test_multibytecodec_support.py
+++ b/Lib/test/test_multibytecodec_support.py
@@ -4,7 +4,7 @@
 #   Common Unittest Routines for CJK codecs
 #
 
-import sys, codecs, os.path
+import sys, codecs
 import unittest, re
 from test import test_support
 from StringIO import StringIO
diff --git a/Lib/test/test_optparse.py b/Lib/test/test_optparse.py
index 38d5207..7a917d8 100644
--- a/Lib/test/test_optparse.py
+++ b/Lib/test/test_optparse.py
@@ -16,7 +16,6 @@
 import unittest
 
 from StringIO import StringIO
-from pprint import pprint
 from test import test_support
 
 
diff --git a/Lib/test/test_ossaudiodev.py b/Lib/test/test_ossaudiodev.py
index 83cc344..f2ce67b 100644
--- a/Lib/test/test_ossaudiodev.py
+++ b/Lib/test/test_ossaudiodev.py
@@ -1,14 +1,11 @@
 from test import test_support
 test_support.requires('audio')
 
-from test.test_support import verbose, findfile, TestSkipped
+from test.test_support import findfile, TestSkipped
 
 import errno
-import fcntl
 import ossaudiodev
-import os
 import sys
-import select
 import sunaudio
 import time
 import audioop
diff --git a/Lib/test/test_pickle.py b/Lib/test/test_pickle.py
index 585644e..fb10ffe 100644
--- a/Lib/test/test_pickle.py
+++ b/Lib/test/test_pickle.py
@@ -1,5 +1,4 @@
 import pickle
-import unittest
 from cStringIO import StringIO
 
 from test import test_support
diff --git a/Lib/test/test_pkg.py b/Lib/test/test_pkg.py
index 28f9943..4fa367f 100644
--- a/Lib/test/test_pkg.py
+++ b/Lib/test/test_pkg.py
@@ -4,7 +4,6 @@
 import os
 import tempfile
 import textwrap
-import traceback
 import unittest
 from test import test_support
 
diff --git a/Lib/test/test_plistlib.py b/Lib/test/test_plistlib.py
index 8e8d3e3..47630dc 100644
--- a/Lib/test/test_plistlib.py
+++ b/Lib/test/test_plistlib.py
@@ -3,7 +3,6 @@
 import unittest
 import plistlib
 import os
-import time
 import datetime
 from test import test_support
 
diff --git a/Lib/test/test_poll.py b/Lib/test/test_poll.py
index 60cd3f4..5dbfc2c 100644
--- a/Lib/test/test_poll.py
+++ b/Lib/test/test_poll.py
@@ -1,6 +1,6 @@
 # Test case for the os.poll() function
 
-import sys, os, select, random, unittest
+import os, select, random, unittest
 from test.test_support import TestSkipped, TESTFN, run_unittest
 
 try:
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index 7207de5..1fb3c48 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -9,7 +9,6 @@
 
 import time
 import os
-import sys
 import unittest
 import warnings
 warnings.filterwarnings('ignore', '.* potential security risk .*',
diff --git a/Lib/test/test_pyclbr.py b/Lib/test/test_pyclbr.py
index 56fb683..d1291a0 100644
--- a/Lib/test/test_pyclbr.py
+++ b/Lib/test/test_pyclbr.py
@@ -3,7 +3,7 @@
    Nick Mathewson
 '''
 from test.test_support import run_unittest
-import unittest, sys
+import sys
 from types import ClassType, FunctionType, MethodType, BuiltinFunctionType
 import pyclbr
 from unittest import TestCase
diff --git a/Lib/test/test_quopri.py b/Lib/test/test_quopri.py
index 631c974..24a2f44 100644
--- a/Lib/test/test_quopri.py
+++ b/Lib/test/test_quopri.py
@@ -1,7 +1,7 @@
 from test import test_support
 import unittest
 
-import sys, os, cStringIO, subprocess
+import sys, cStringIO, subprocess
 import quopri
 
 
diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py
index 225f882..f354a1b 100644
--- a/Lib/test/test_resource.py
+++ b/Lib/test/test_resource.py
@@ -1,7 +1,6 @@
 import unittest
 from test import test_support
 
-import os
 import resource
 import time
 
diff --git a/Lib/test/test_rfc822.py b/Lib/test/test_rfc822.py
index 6d22825..197887d 100644
--- a/Lib/test/test_rfc822.py
+++ b/Lib/test/test_rfc822.py
@@ -1,5 +1,4 @@
 import rfc822
-import sys
 import unittest
 from test import test_support
 
diff --git a/Lib/test/test_scriptpackages.py b/Lib/test/test_scriptpackages.py
index a2e03f9..ee14be2 100644
--- a/Lib/test/test_scriptpackages.py
+++ b/Lib/test/test_scriptpackages.py
@@ -1,9 +1,6 @@
 # Copyright (C) 2003 Python Software Foundation
 
 import unittest
-import os
-import sys
-import tempfile
 from test import test_support
 import aetools
 
diff --git a/Lib/test/test_sgmllib.py b/Lib/test/test_sgmllib.py
index b698636..d9c9ddc 100644
--- a/Lib/test/test_sgmllib.py
+++ b/Lib/test/test_sgmllib.py
@@ -1,4 +1,3 @@
-import htmlentitydefs
 import pprint
 import re
 import sgmllib
@@ -116,7 +115,7 @@
         try:
             events = self.get_events(source)
         except:
-            import sys
+            #import sys
             #print >>sys.stderr, pprint.pformat(self.events)
             raise
         if events != expected_events:
diff --git a/Lib/test/test_shlex.py b/Lib/test/test_shlex.py
index 5c6572a..6c35f49 100644
--- a/Lib/test/test_shlex.py
+++ b/Lib/test/test_shlex.py
@@ -1,6 +1,5 @@
 # -*- coding: iso-8859-1 -*-
 import unittest
-import os, sys
 import shlex
 
 from test import test_support
diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py
index 3a8b9d3..c9957df 100644
--- a/Lib/test/test_site.py
+++ b/Lib/test/test_site.py
@@ -5,12 +5,11 @@
 
 """
 import unittest
-from test.test_support import TestSkipped, TestFailed, run_unittest, TESTFN
+from test.test_support import TestSkipped, run_unittest, TESTFN
 import __builtin__
 import os
 import sys
 import encodings
-import tempfile
 # Need to make sure to not import 'site' if someone specified ``-S`` at the
 # command-line.  Detect this by just making sure 'site' has not been imported
 # already.
diff --git a/Lib/test/test_socketserver.py b/Lib/test/test_socketserver.py
index 79f3038..07dd778 100644
--- a/Lib/test/test_socketserver.py
+++ b/Lib/test/test_socketserver.py
@@ -9,7 +9,6 @@
 import select
 import time
 import threading
-from functools import wraps
 import unittest
 import SocketServer
 
diff --git a/Lib/test/test_sqlite.py b/Lib/test/test_sqlite.py
index f033772..c1523e1 100644
--- a/Lib/test/test_sqlite.py
+++ b/Lib/test/test_sqlite.py
@@ -1,5 +1,4 @@
 from test.test_support import run_unittest, TestSkipped
-import unittest
 
 try:
     import _sqlite3
diff --git a/Lib/test/test_str.py b/Lib/test/test_str.py
index 7ea46bb..37db252 100644
--- a/Lib/test/test_str.py
+++ b/Lib/test/test_str.py
@@ -1,5 +1,4 @@
 
-import unittest
 import struct
 import sys
 from test import test_support, string_tests
diff --git a/Lib/test/test_strftime.py b/Lib/test/test_strftime.py
index e9d3826..1105c00 100755
--- a/Lib/test/test_strftime.py
+++ b/Lib/test/test_strftime.py
@@ -2,7 +2,7 @@
 
 # Sanity checker for time.strftime
 
-import time, calendar, sys, os, re
+import time, calendar, sys, re
 from test.test_support import verbose
 
 def main():
diff --git a/Lib/test/test_sunaudiodev.py b/Lib/test/test_sunaudiodev.py
index f203d9a..3750542 100644
--- a/Lib/test/test_sunaudiodev.py
+++ b/Lib/test/test_sunaudiodev.py
@@ -1,4 +1,4 @@
-from test.test_support import verbose, findfile, TestFailed, TestSkipped
+from test.test_support import findfile, TestFailed, TestSkipped
 import sunaudiodev
 import os
 
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py
index 9b4372c..d36d81c 100644
--- a/Lib/test/test_support.py
+++ b/Lib/test/test_support.py
@@ -10,7 +10,6 @@
 import os
 import os.path
 import warnings
-import types
 import unittest
 
 class Error(Exception):
diff --git a/Lib/test/test_tuple.py b/Lib/test/test_tuple.py
index dddb03e..c413709 100644
--- a/Lib/test/test_tuple.py
+++ b/Lib/test/test_tuple.py
@@ -1,4 +1,3 @@
-import unittest
 from test import test_support, seq_tests
 
 class TupleTest(seq_tests.CommonTest):
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py
index ccb9411f..bdc7192 100644
--- a/Lib/test/test_unicode.py
+++ b/Lib/test/test_unicode.py
@@ -6,7 +6,7 @@
 (c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
 
 """#"
-import unittest, sys, struct, codecs, new
+import sys, struct, codecs
 from test import test_support, string_tests
 
 # Error handling (bad decoder return)
diff --git a/Lib/test/test_unpack.py b/Lib/test/test_unpack.py
index 76a4822..7ddbc62 100644
--- a/Lib/test/test_unpack.py
+++ b/Lib/test/test_unpack.py
@@ -122,7 +122,6 @@
 __test__ = {'doctests' : doctests}
 
 def test_main(verbose=False):
-    import sys
     from test import test_support
     from test import test_unpack
     test_support.run_doctest(test_unpack, verbose)
diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py
index 455e7fc..0c669d0 100644
--- a/Lib/test/test_urllib.py
+++ b/Lib/test/test_urllib.py
@@ -8,10 +8,6 @@
 import mimetools
 import tempfile
 import StringIO
-import ftplib
-import threading
-import socket
-import time
 
 def hexescape(char):
     """Escape char as RFC 2396 specifies"""
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py
index a35cbfa..5727f8a 100644
--- a/Lib/test/test_urllib2.py
+++ b/Lib/test/test_urllib2.py
@@ -1,7 +1,7 @@
 import unittest
 from test import test_support
 
-import os, socket
+import os
 import StringIO
 
 import urllib2
@@ -589,7 +589,7 @@
             self.assertEqual(int(headers["Content-length"]), len(data))
 
     def test_file(self):
-        import time, rfc822, socket
+        import rfc822, socket
         h = urllib2.FileHandler()
         o = h.parent = MockOpener()
 
@@ -993,7 +993,7 @@
     def _test_basic_auth(self, opener, auth_handler, auth_header,
                          realm, http_handler, password_manager,
                          request_url, protected_url):
-        import base64, httplib
+        import base64
         user, password = "wile", "coyote"
 
         # .add_password() fed through to password manager
diff --git a/Lib/test/test_urllib2_localnet.py b/Lib/test/test_urllib2_localnet.py
index b347e82..54bf2d9 100644
--- a/Lib/test/test_urllib2_localnet.py
+++ b/Lib/test/test_urllib2_localnet.py
@@ -1,6 +1,5 @@
 #!/usr/bin/env python
 
-import sys
 import threading
 import urlparse
 import urllib2
diff --git a/Lib/test/test_userdict.py b/Lib/test/test_userdict.py
index 357c0f0..0818e98 100644
--- a/Lib/test/test_userdict.py
+++ b/Lib/test/test_userdict.py
@@ -1,6 +1,5 @@
 # Check every path through every method of UserDict
 
-import unittest
 from test import test_support, mapping_tests
 import UserDict
 
diff --git a/Lib/test/test_userlist.py b/Lib/test/test_userlist.py
index 8c7ef2e..ed3e559 100644
--- a/Lib/test/test_userlist.py
+++ b/Lib/test/test_userlist.py
@@ -1,7 +1,6 @@
 # Check every path through every method of UserList
 
 from UserList import UserList
-import unittest
 from test import test_support, list_tests
 
 class UserListTest(list_tests.CommonTest):
diff --git a/Lib/test/test_userstring.py b/Lib/test/test_userstring.py
index b66dffe..06636fc 100755
--- a/Lib/test/test_userstring.py
+++ b/Lib/test/test_userstring.py
@@ -2,7 +2,6 @@
 # UserString is a wrapper around the native builtin string type.
 # UserString instances should behave similar to builtin string objects.
 
-import unittest
 import string
 from test import test_support, string_tests
 
diff --git a/Lib/test/test_uu.py b/Lib/test/test_uu.py
index 27d0d89..9aad56e 100644
--- a/Lib/test/test_uu.py
+++ b/Lib/test/test_uu.py
@@ -8,7 +8,6 @@
 
 import sys, os, uu, cStringIO
 import uu
-from StringIO import StringIO
 
 plaintext = "The smooth-scaled python crept over the sleeping dog\n"
 
diff --git a/Lib/test/test_whichdb.py b/Lib/test/test_whichdb.py
index f2652c1..1ce816f 100644
--- a/Lib/test/test_whichdb.py
+++ b/Lib/test/test_whichdb.py
@@ -8,7 +8,6 @@
 import unittest
 import whichdb
 import anydbm
-import tempfile
 import glob
 
 _fname = test.test_support.TESTFN
diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py
index 78adb42..65c99f1 100644
--- a/Lib/test/test_xml_etree.py
+++ b/Lib/test/test_xml_etree.py
@@ -2,7 +2,8 @@
 # all included components work as they should.  For a more extensive
 # test suite, see the selftest script in the ElementTree distribution.
 
-import doctest, sys
+import doctest
+import sys
 
 from test import test_support
 
diff --git a/Lib/test/test_xml_etree_c.py b/Lib/test/test_xml_etree_c.py
index 250f791..7ddd44b 100644
--- a/Lib/test/test_xml_etree_c.py
+++ b/Lib/test/test_xml_etree_c.py
@@ -1,6 +1,7 @@
 # xml.etree test for cElementTree
 
-import doctest, sys
+import doctest
+import sys
 
 from test import test_support
 
diff --git a/Lib/test/test_xpickle.py b/Lib/test/test_xpickle.py
index 42cd0f4..3ffb744 100644
--- a/Lib/test/test_xpickle.py
+++ b/Lib/test/test_xpickle.py
@@ -5,7 +5,6 @@
 
 import pickle
 import cPickle
-import unittest
 
 from test import test_support
 from test.pickletester import AbstractPickleTests
diff --git a/Lib/test/test_zipfile64.py b/Lib/test/test_zipfile64.py
index 449cf39..6ce2ae5 100644
--- a/Lib/test/test_zipfile64.py
+++ b/Lib/test/test_zipfile64.py
@@ -20,7 +20,6 @@
 import time
 import sys
 
-from StringIO import StringIO
 from tempfile import TemporaryFile
 
 from test.test_support import TESTFN, run_unittest