diff --git a/Lib/email/test/test_email_torture.py b/Lib/email/test/test_email_torture.py index 3ec4c6653b5..9dfa6028811 100644 --- a/Lib/email/test/test_email_torture.py +++ b/Lib/email/test/test_email_torture.py @@ -13,7 +13,7 @@ from cStringIO import StringIO from types import ListType from email.test.test_email import TestEmailBase -from test.test_support import TestSkipped +from test.test_support import TestSkipped, run_unittest import email from email import __file__ as testfile @@ -128,7 +128,7 @@ def suite(): def test_main(): for testclass in _testclasses(): - test_support.run_unittest(testclass) + run_unittest(testclass) diff --git a/Lib/plat-mac/Carbon/MediaDescr.py b/Lib/plat-mac/Carbon/MediaDescr.py index 254634bb29b..5431d1e3e89 100644 --- a/Lib/plat-mac/Carbon/MediaDescr.py +++ b/Lib/plat-mac/Carbon/MediaDescr.py @@ -15,7 +15,7 @@ class _MediaDescriptionCodec: data = data[:self.size] values = struct.unpack(self.fmt, data) if len(values) != len(self.names): - raise Error, ('Format length does not match number of names', descr) + raise Error, ('Format length does not match number of names') rv = {} for i in range(len(values)): name = self.names[i] @@ -26,7 +26,7 @@ class _MediaDescriptionCodec: rv[name] = value return rv - def encode(dict): + def encode(self, dict): list = [self.fmt] for name in self.names: if type(name) == type(()): diff --git a/Lib/plat-mac/bundlebuilder.py b/Lib/plat-mac/bundlebuilder.py index 13b3e4b3db7..42ba1eebdbc 100755 --- a/Lib/plat-mac/bundlebuilder.py +++ b/Lib/plat-mac/bundlebuilder.py @@ -426,7 +426,7 @@ class AppBuilder(BundleBuilder): pass elif self.mainprogram is not None: self.name = os.path.splitext(os.path.basename(self.mainprogram))[0] - elif executable is not None: + elif self.executable is not None: self.name = os.path.splitext(os.path.basename(self.executable))[0] if self.name[-4:] != ".app": self.name += ".app" diff --git a/Lib/plat-mac/macostools.py b/Lib/plat-mac/macostools.py index 337cc7f1f1d..395001ddc12 100644 --- a/Lib/plat-mac/macostools.py +++ b/Lib/plat-mac/macostools.py @@ -10,6 +10,7 @@ warnpy3k("In 3.x, the macostools module is removed.", stacklevel=2) from Carbon import Res from Carbon import File, Files import os +import errno import MacOS try: openrf = MacOS.openrf diff --git a/Lib/test/test_cfgparser.py b/Lib/test/test_cfgparser.py index a0d80513d51..78657de85d5 100644 --- a/Lib/test/test_cfgparser.py +++ b/Lib/test/test_cfgparser.py @@ -17,8 +17,9 @@ class SortedDict(UserDict.UserDict): return result def values(self): + # XXX never used? result = self.items() - return [i[1] for i in values] + return [i[1] for i in result] def iteritems(self): return iter(self.items()) def iterkeys(self): return iter(self.keys()) diff --git a/Lib/test/test_docxmlrpc.py b/Lib/test/test_docxmlrpc.py index 57813c9cd22..13a3a9f83ac 100644 --- a/Lib/test/test_docxmlrpc.py +++ b/Lib/test/test_docxmlrpc.py @@ -3,6 +3,7 @@ import httplib from test import test_support import threading import time +import socket import unittest import xmlrpclib diff --git a/Lib/test/test_long.py b/Lib/test/test_long.py index 5addd2e8758..a91b644262e 100644 --- a/Lib/test/test_long.py +++ b/Lib/test/test_long.py @@ -506,7 +506,7 @@ class LongTest(unittest.TestCase): except OverflowError: self.fail("int(long(sys.maxint)) overflowed!") if not isinstance(x, int): - raise TestFailed("int(long(sys.maxint)) should have returned int") + self.fail("int(long(sys.maxint)) should have returned int") x = int(hugeneg_aslong) try: self.assertEqual(x, hugeneg, @@ -514,8 +514,7 @@ class LongTest(unittest.TestCase): except OverflowError: self.fail("int(long(-sys.maxint-1)) overflowed!") if not isinstance(x, int): - raise TestFailed("int(long(-sys.maxint-1)) should have " - "returned int") + self.fail("int(long(-sys.maxint-1)) should have returned int") # but long -> int should overflow for hugepos+1 and hugeneg-1 x = hugepos_aslong + 1 try: @@ -714,7 +713,7 @@ class LongTest(unittest.TestCase): self.d = d assert float(n) / float(d) == value else: - raise TypeError("can't deal with %r" % val) + raise TypeError("can't deal with %r" % value) def __cmp__(self, other): if not isinstance(other, Rat): diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py index f1f137877e6..16977a5495b 100644 --- a/Lib/test/test_minidom.py +++ b/Lib/test/test_minidom.py @@ -1295,12 +1295,13 @@ class MinidomTest(unittest.TestCase): self.confirm(len(n1.entities) == len(n2.entities) and len(n1.notations) == len(n2.notations)) for i in range(len(n1.notations)): + # XXX this loop body doesn't seem to be executed? no1 = n1.notations.item(i) no2 = n1.notations.item(i) self.confirm(no1.name == no2.name and no1.publicId == no2.publicId and no1.systemId == no2.systemId) - statck.append((no1, no2)) + stack.append((no1, no2)) for i in range(len(n1.entities)): e1 = n1.entities.item(i) e2 = n2.entities.item(i) diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py index 107cd622ac1..4bd877c9387 100644 --- a/Lib/test/test_multiprocessing.py +++ b/Lib/test/test_multiprocessing.py @@ -1560,10 +1560,10 @@ class _TestSharedCTypes(BaseTestCase): return x = Value('i', 7, lock=lock) - y = Value(ctypes.c_double, 1.0/3.0, lock=lock) + y = Value(c_double, 1.0/3.0, lock=lock) foo = Value(_Foo, 3, 2, lock=lock) - arr = Array('d', range(10), lock=lock) - string = Array('c', 20, lock=lock) + arr = self.Array('d', range(10), lock=lock) + string = self.Array('c', 20, lock=lock) string.value = 'hello' p = self.Process(target=self._double, args=(x, y, foo, arr, string)) diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py index c3fd32322d6..2177123dae0 100644 --- a/Lib/test/test_platform.py +++ b/Lib/test/test_platform.py @@ -128,8 +128,10 @@ class PlatformTest(unittest.TestCase): if os.path.isdir(sys.executable) and \ os.path.exists(sys.executable+'.exe'): # Cygwin horror - executable = executable + '.exe' - res = platform.libc_ver(sys.executable) + executable = sys.executable + '.exe' + else: + executable = sys.executable + res = platform.libc_ver(executable) def test_parse_release_file(self): diff --git a/Lib/test/test_sgmllib.py b/Lib/test/test_sgmllib.py index 081e0e17fc9..c18bcc337d5 100644 --- a/Lib/test/test_sgmllib.py +++ b/Lib/test/test_sgmllib.py @@ -298,14 +298,6 @@ DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01//EN' ("starttag", "a", [("href", "http://[1080::8:800:200C:417A]/")]), ]) - def test_illegal_declarations(self): - s = 'abcdef' - self.check_events(s, [ - ("data", "abc"), - ("unknown decl", 'spacer type="block" height="25"'), - ("data", "def"), - ]) - def test_weird_starttags(self): self.check_events("", [ ("starttag", "a", []), diff --git a/Lib/urllib.py b/Lib/urllib.py index 1ae08a0be46..03f6f5a3232 100644 --- a/Lib/urllib.py +++ b/Lib/urllib.py @@ -28,7 +28,6 @@ import os import time import sys from urlparse import urljoin as basejoin -import warnings __all__ = ["urlopen", "URLopener", "FancyURLopener", "urlretrieve", "urlcleanup", "quote", "quote_plus", "unquote", "unquote_plus", @@ -72,8 +71,8 @@ _urlopener = None def urlopen(url, data=None, proxies=None): """Create a file-like object for the specified URL to read from.""" from warnings import warnpy3k - warnings.warnpy3k("urllib.urlopen() has been removed in Python 3.0 in " - "favor of urllib2.urlopen()", stacklevel=2) + warnpy3k("urllib.urlopen() has been removed in Python 3.0 in " + "favor of urllib2.urlopen()", stacklevel=2) global _urlopener if proxies is not None: