[Python-checkins] r64953 - in python/trunk/Lib: mimetools.py plat-mac/Audio_mac.py plat-mac/Carbon/__init__.py plat-mac/EasyDialogs.py plat-mac/FrameWork.py plat-mac/MiniAEFrame.py plat-mac/PixMapWrapper.py plat-mac/aepack.py plat-mac/aetools.py plat-mac/aetypes.py plat-mac/applesingle.py plat-mac/appletrawmain.py plat-mac/appletrunner.py plat-mac/argvemulator.py plat-mac/bgenlocations.py plat-mac/buildtools.py plat-mac/bundlebuilder.py plat-mac/cfmfile.py plat-mac/findertools.py plat-mac/gensuitemodule.py plat-mac/ic.py plat-mac/icopen.py plat-mac/lib-scriptpackages/CodeWarrior/__init__.py plat-mac/lib-scriptpackages/Explorer/__init__.py plat-mac/lib-scriptpackages/Finder/__init__.py plat-mac/lib-scriptpackages/Netscape/__init__.py plat-mac/lib-scriptpackages/StdSuites/__init__.py plat-mac/lib-scriptpackages/SystemEvents/__init__.py plat-mac/lib-scriptpackages/Terminal/__init__.py plat-mac/lib-scriptpackages/_builtinSuites/__init__.py plat-mac/macerrors.py plat-mac/macostools.py plat-mac/macresource.py plat-mac/pimp.py plat-mac/terminalcommand.py plat-mac/videoreader.py rfc822.py test/test_py3kwarn.py
benjamin.peterson
python-checkins at python.org
Mon Jul 14 19:42:29 CEST 2008
Author: benjamin.peterson
Date: Mon Jul 14 19:42:17 2008
New Revision: 64953
Log:
fix test_py3kwarns
The fact that this was failing and went unnoticed so long seems like a good argument for being able to enable and disble py3kwarnings through Python.
Modified:
python/trunk/Lib/mimetools.py
python/trunk/Lib/plat-mac/Audio_mac.py
python/trunk/Lib/plat-mac/Carbon/__init__.py
python/trunk/Lib/plat-mac/EasyDialogs.py
python/trunk/Lib/plat-mac/FrameWork.py
python/trunk/Lib/plat-mac/MiniAEFrame.py
python/trunk/Lib/plat-mac/PixMapWrapper.py
python/trunk/Lib/plat-mac/aepack.py
python/trunk/Lib/plat-mac/aetools.py
python/trunk/Lib/plat-mac/aetypes.py
python/trunk/Lib/plat-mac/applesingle.py
python/trunk/Lib/plat-mac/appletrawmain.py
python/trunk/Lib/plat-mac/appletrunner.py
python/trunk/Lib/plat-mac/argvemulator.py
python/trunk/Lib/plat-mac/bgenlocations.py
python/trunk/Lib/plat-mac/buildtools.py
python/trunk/Lib/plat-mac/bundlebuilder.py
python/trunk/Lib/plat-mac/cfmfile.py
python/trunk/Lib/plat-mac/findertools.py
python/trunk/Lib/plat-mac/gensuitemodule.py
python/trunk/Lib/plat-mac/ic.py
python/trunk/Lib/plat-mac/icopen.py
python/trunk/Lib/plat-mac/lib-scriptpackages/CodeWarrior/__init__.py
python/trunk/Lib/plat-mac/lib-scriptpackages/Explorer/__init__.py
python/trunk/Lib/plat-mac/lib-scriptpackages/Finder/__init__.py
python/trunk/Lib/plat-mac/lib-scriptpackages/Netscape/__init__.py
python/trunk/Lib/plat-mac/lib-scriptpackages/StdSuites/__init__.py
python/trunk/Lib/plat-mac/lib-scriptpackages/SystemEvents/__init__.py
python/trunk/Lib/plat-mac/lib-scriptpackages/Terminal/__init__.py
python/trunk/Lib/plat-mac/lib-scriptpackages/_builtinSuites/__init__.py
python/trunk/Lib/plat-mac/macerrors.py
python/trunk/Lib/plat-mac/macostools.py
python/trunk/Lib/plat-mac/macresource.py
python/trunk/Lib/plat-mac/pimp.py
python/trunk/Lib/plat-mac/terminalcommand.py
python/trunk/Lib/plat-mac/videoreader.py
python/trunk/Lib/rfc822.py
python/trunk/Lib/test/test_py3kwarn.py
Modified: python/trunk/Lib/mimetools.py
==============================================================================
--- python/trunk/Lib/mimetools.py (original)
+++ python/trunk/Lib/mimetools.py Mon Jul 14 19:42:17 2008
@@ -6,7 +6,8 @@
import tempfile
from warnings import warnpy3k
-warnpy3k("in 3.x, mimetools has been removed in favor of the email package")
+warnpy3k("in 3.x, mimetools has been removed in favor of the email package",
+ stacklevel=2)
__all__ = ["Message","choose_boundary","encode","decode","copyliteral",
"copybinary"]
Modified: python/trunk/Lib/plat-mac/Audio_mac.py
==============================================================================
--- python/trunk/Lib/plat-mac/Audio_mac.py (original)
+++ python/trunk/Lib/plat-mac/Audio_mac.py Mon Jul 14 19:42:17 2008
@@ -2,7 +2,7 @@
error='Audio_mac.error'
from warnings import warnpy3k
-warnpy3k("In 3.x, the Play_Audio_mac module is removed.")
+warnpy3k("In 3.x, the Play_Audio_mac module is removed.", stacklevel=2)
class Play_Audio_mac:
Modified: python/trunk/Lib/plat-mac/Carbon/__init__.py
==============================================================================
--- python/trunk/Lib/plat-mac/Carbon/__init__.py (original)
+++ python/trunk/Lib/plat-mac/Carbon/__init__.py Mon Jul 14 19:42:17 2008
@@ -4,4 +4,4 @@
warnings.filterwarnings("ignore", "", FutureWarning, ".*MacTextEditor")
from warnings import warnpy3k
-warnpy3k("In 3.x, Carbon is removed.")
+warnpy3k("In 3.x, Carbon is removed.", stacklevel=2)
Modified: python/trunk/Lib/plat-mac/EasyDialogs.py
==============================================================================
--- python/trunk/Lib/plat-mac/EasyDialogs.py (original)
+++ python/trunk/Lib/plat-mac/EasyDialogs.py Mon Jul 14 19:42:17 2008
@@ -19,7 +19,7 @@
"""
from warnings import warnpy3k
-warnpy3k("In 3.x, the EasyDialogs module is removed.")
+warnpy3k("In 3.x, the EasyDialogs module is removed.", stacklevel=2)
from Carbon.Dlg import GetNewDialog, SetDialogItemText, GetDialogItemText, ModalDialog
from Carbon import Qd
Modified: python/trunk/Lib/plat-mac/FrameWork.py
==============================================================================
--- python/trunk/Lib/plat-mac/FrameWork.py (original)
+++ python/trunk/Lib/plat-mac/FrameWork.py Mon Jul 14 19:42:17 2008
@@ -3,7 +3,7 @@
DEBUG=0
from warnings import warnpy3k
-warnpy3k("In 3.x, the FrameWork module is removed.")
+warnpy3k("In 3.x, the FrameWork module is removed.", stacklevel=2)
import MacOS
import traceback
Modified: python/trunk/Lib/plat-mac/MiniAEFrame.py
==============================================================================
--- python/trunk/Lib/plat-mac/MiniAEFrame.py (original)
+++ python/trunk/Lib/plat-mac/MiniAEFrame.py Mon Jul 14 19:42:17 2008
@@ -7,7 +7,7 @@
"""
from warnings import warnpy3k
-warnpy3k("In 3.x, the MiniAEFrame module is removed.")
+warnpy3k("In 3.x, the MiniAEFrame module is removed.", stacklevel=2)
import traceback
import MacOS
Modified: python/trunk/Lib/plat-mac/PixMapWrapper.py
==============================================================================
--- python/trunk/Lib/plat-mac/PixMapWrapper.py (original)
+++ python/trunk/Lib/plat-mac/PixMapWrapper.py Mon Jul 14 19:42:17 2008
@@ -7,7 +7,7 @@
from warnings import warnpy3k
-warnpy3k("In 3.x, the PixMapWrapper module is removed.")
+warnpy3k("In 3.x, the PixMapWrapper module is removed.", stacklevel=2)
from Carbon import Qd
from Carbon import QuickDraw
Modified: python/trunk/Lib/plat-mac/aepack.py
==============================================================================
--- python/trunk/Lib/plat-mac/aepack.py (original)
+++ python/trunk/Lib/plat-mac/aepack.py Mon Jul 14 19:42:17 2008
@@ -13,7 +13,7 @@
#
from warnings import warnpy3k
-warnpy3k("In 3.x, the aepack module is removed.")
+warnpy3k("In 3.x, the aepack module is removed.", stacklevel=2)
import struct
import types
Modified: python/trunk/Lib/plat-mac/aetools.py
==============================================================================
--- python/trunk/Lib/plat-mac/aetools.py (original)
+++ python/trunk/Lib/plat-mac/aetools.py Mon Jul 14 19:42:17 2008
@@ -22,7 +22,7 @@
from warnings import warnpy3k
-warnpy3k("In 3.x, the aetools module is removed.")
+warnpy3k("In 3.x, the aetools module is removed.", stacklevel=2)
from types import *
from Carbon import AE
Modified: python/trunk/Lib/plat-mac/aetypes.py
==============================================================================
--- python/trunk/Lib/plat-mac/aetypes.py (original)
+++ python/trunk/Lib/plat-mac/aetypes.py Mon Jul 14 19:42:17 2008
@@ -1,7 +1,7 @@
"""aetypes - Python objects representing various AE types."""
from warnings import warnpy3k
-warnpy3k("In 3.x, the aetypes module is removed.")
+warnpy3k("In 3.x, the aetypes module is removed.", stacklevel=2)
from Carbon.AppleEvents import *
import struct
Modified: python/trunk/Lib/plat-mac/applesingle.py
==============================================================================
--- python/trunk/Lib/plat-mac/applesingle.py (original)
+++ python/trunk/Lib/plat-mac/applesingle.py Mon Jul 14 19:42:17 2008
@@ -2,7 +2,7 @@
"""
from warnings import warnpy3k
-warnpy3k("In 3.x, the applesingle module is removed.")
+warnpy3k("In 3.x, the applesingle module is removed.", stacklevel=2)
import struct
import sys
Modified: python/trunk/Lib/plat-mac/appletrawmain.py
==============================================================================
--- python/trunk/Lib/plat-mac/appletrawmain.py (original)
+++ python/trunk/Lib/plat-mac/appletrawmain.py Mon Jul 14 19:42:17 2008
@@ -6,7 +6,7 @@
#
from warnings import warnpy3k
-warnpy3k("In 3.x, the appletrawmain module is removed.")
+warnpy3k("In 3.x, the appletrawmain module is removed.", stacklevel=2)
import argvemulator
import os
Modified: python/trunk/Lib/plat-mac/appletrunner.py
==============================================================================
--- python/trunk/Lib/plat-mac/appletrunner.py (original)
+++ python/trunk/Lib/plat-mac/appletrunner.py Mon Jul 14 19:42:17 2008
@@ -4,7 +4,7 @@
# we are not running in a framework build.
from warnings import warnpy3k
-warnpy3k("In 3.x, appletrunner is removed.")
+warnpy3k("In 3.x, appletrunner is removed.", stacklevel=2)
import os
import sys
Modified: python/trunk/Lib/plat-mac/argvemulator.py
==============================================================================
--- python/trunk/Lib/plat-mac/argvemulator.py (original)
+++ python/trunk/Lib/plat-mac/argvemulator.py Mon Jul 14 19:42:17 2008
@@ -3,7 +3,7 @@
"""
from warnings import warnpy3k
-warnpy3k("In 3.x, the argvemulator module is removed.")
+warnpy3k("In 3.x, the argvemulator module is removed.", stacklevel=2)
import sys
import traceback
Modified: python/trunk/Lib/plat-mac/bgenlocations.py
==============================================================================
--- python/trunk/Lib/plat-mac/bgenlocations.py (original)
+++ python/trunk/Lib/plat-mac/bgenlocations.py Mon Jul 14 19:42:17 2008
@@ -8,7 +8,7 @@
import os
from warnings import warnpy3k
-warnpy3k("In 3.x, the bgenlocations module is removed.")
+warnpy3k("In 3.x, the bgenlocations module is removed.", stacklevel=2)
Error = "bgenlocations.Error"
#
Modified: python/trunk/Lib/plat-mac/buildtools.py
==============================================================================
--- python/trunk/Lib/plat-mac/buildtools.py (original)
+++ python/trunk/Lib/plat-mac/buildtools.py Mon Jul 14 19:42:17 2008
@@ -1,8 +1,8 @@
"""tools for BuildApplet and BuildApplication"""
import warnings
-warnings.warn("the buildtools module is deprecated and is removed in 3.0",
- DeprecationWarning, 2)
+warnings.warnpy3k("the buildtools module is deprecated and is removed in 3.0",
+ stacklevel=2)
import sys
import os
Modified: python/trunk/Lib/plat-mac/bundlebuilder.py
==============================================================================
--- python/trunk/Lib/plat-mac/bundlebuilder.py (original)
+++ python/trunk/Lib/plat-mac/bundlebuilder.py Mon Jul 14 19:42:17 2008
@@ -29,7 +29,7 @@
from warnings import warnpy3k
-warnpy3k("In 3.x, the bundlebuilder module is removed.")
+warnpy3k("In 3.x, the bundlebuilder module is removed.", stacklevel=2)
import sys
import os, errno, shutil
Modified: python/trunk/Lib/plat-mac/cfmfile.py
==============================================================================
--- python/trunk/Lib/plat-mac/cfmfile.py (original)
+++ python/trunk/Lib/plat-mac/cfmfile.py Mon Jul 14 19:42:17 2008
@@ -6,8 +6,8 @@
__author__ = "jvr"
import warnings
-warnings.warn("the cfmfile module is deprecated and is removed in 3,0",
- DeprecationWarning, 2)
+warnings.warnpy3k("the cfmfile module is deprecated and is removed in 3,0",
+ stacklevel=2)
import Carbon.File
import struct
Modified: python/trunk/Lib/plat-mac/findertools.py
==============================================================================
--- python/trunk/Lib/plat-mac/findertools.py (original)
+++ python/trunk/Lib/plat-mac/findertools.py Mon Jul 14 19:42:17 2008
@@ -16,7 +16,7 @@
"""
from warnings import warnpy3k
-warnpy3k("In 3.x, the findertools module is removed.")
+warnpy3k("In 3.x, the findertools module is removed.", stacklevel=2)
import Finder
from Carbon import AppleEvents
Modified: python/trunk/Lib/plat-mac/gensuitemodule.py
==============================================================================
--- python/trunk/Lib/plat-mac/gensuitemodule.py (original)
+++ python/trunk/Lib/plat-mac/gensuitemodule.py Mon Jul 14 19:42:17 2008
@@ -7,7 +7,7 @@
"""
from warnings import warnpy3k
-warnpy3k("In 3.x, the gensuitemodule module is removed.")
+warnpy3k("In 3.x, the gensuitemodule module is removed.", stacklevel=2)
import MacOS
import EasyDialogs
Modified: python/trunk/Lib/plat-mac/ic.py
==============================================================================
--- python/trunk/Lib/plat-mac/ic.py (original)
+++ python/trunk/Lib/plat-mac/ic.py Mon Jul 14 19:42:17 2008
@@ -1,7 +1,7 @@
"""IC wrapper module, based on Internet Config 1.3"""
from warnings import warnpy3k
-warnpy3k("In 3.x, the ic module is removed.")
+warnpy3k("In 3.x, the ic module is removed.", stacklevel=2)
import icglue
import string
Modified: python/trunk/Lib/plat-mac/icopen.py
==============================================================================
--- python/trunk/Lib/plat-mac/icopen.py (original)
+++ python/trunk/Lib/plat-mac/icopen.py Mon Jul 14 19:42:17 2008
@@ -38,7 +38,7 @@
"""
from warnings import warnpy3k
-warnpy3k("In 3.x, the icopen module is removed.")
+warnpy3k("In 3.x, the icopen module is removed.", stacklevel=2)
import __builtin__
Modified: python/trunk/Lib/plat-mac/lib-scriptpackages/CodeWarrior/__init__.py
==============================================================================
--- python/trunk/Lib/plat-mac/lib-scriptpackages/CodeWarrior/__init__.py (original)
+++ python/trunk/Lib/plat-mac/lib-scriptpackages/CodeWarrior/__init__.py Mon Jul 14 19:42:17 2008
@@ -3,7 +3,7 @@
"""
from warnings import warnpy3k
-warnpy3k("In 3.x, the CodeWarrior package is removed.")
+warnpy3k("In 3.x, the CodeWarrior package is removed.", stacklevel=2)
import aetools
Error = aetools.Error
Modified: python/trunk/Lib/plat-mac/lib-scriptpackages/Explorer/__init__.py
==============================================================================
--- python/trunk/Lib/plat-mac/lib-scriptpackages/Explorer/__init__.py (original)
+++ python/trunk/Lib/plat-mac/lib-scriptpackages/Explorer/__init__.py Mon Jul 14 19:42:17 2008
@@ -3,7 +3,7 @@
"""
from warnings import warnpy3k
-warnpy3k("In 3.x, the Explorer module is removed.")
+warnpy3k("In 3.x, the Explorer module is removed.", stacklevel=2)
import aetools
Error = aetools.Error
Modified: python/trunk/Lib/plat-mac/lib-scriptpackages/Finder/__init__.py
==============================================================================
--- python/trunk/Lib/plat-mac/lib-scriptpackages/Finder/__init__.py (original)
+++ python/trunk/Lib/plat-mac/lib-scriptpackages/Finder/__init__.py Mon Jul 14 19:42:17 2008
@@ -3,7 +3,7 @@
"""
from warnings import warnpy3k
-warnpy3k("In 3.x, the Finder package is removed.")
+warnpy3k("In 3.x, the Finder package is removed.", stacklevel=2)
import aetools
Error = aetools.Error
Modified: python/trunk/Lib/plat-mac/lib-scriptpackages/Netscape/__init__.py
==============================================================================
--- python/trunk/Lib/plat-mac/lib-scriptpackages/Netscape/__init__.py (original)
+++ python/trunk/Lib/plat-mac/lib-scriptpackages/Netscape/__init__.py Mon Jul 14 19:42:17 2008
@@ -3,7 +3,7 @@
"""
from warnings import warnpy3k
-warnpy3k("In 3.x, the Netscape package is removed.")
+warnpy3k("In 3.x, the Netscape package is removed.", stacklevel=2)
import aetools
Error = aetools.Error
Modified: python/trunk/Lib/plat-mac/lib-scriptpackages/StdSuites/__init__.py
==============================================================================
--- python/trunk/Lib/plat-mac/lib-scriptpackages/StdSuites/__init__.py (original)
+++ python/trunk/Lib/plat-mac/lib-scriptpackages/StdSuites/__init__.py Mon Jul 14 19:42:17 2008
@@ -4,7 +4,7 @@
"""
from warnings import warnpy3k
-warnpy3k("In 3.x, the StdSuites package is removed.")
+warnpy3k("In 3.x, the StdSuites package is removed.", stacklevel=2)
import aetools
Error = aetools.Error
Modified: python/trunk/Lib/plat-mac/lib-scriptpackages/SystemEvents/__init__.py
==============================================================================
--- python/trunk/Lib/plat-mac/lib-scriptpackages/SystemEvents/__init__.py (original)
+++ python/trunk/Lib/plat-mac/lib-scriptpackages/SystemEvents/__init__.py Mon Jul 14 19:42:17 2008
@@ -3,7 +3,7 @@
"""
from warnings import warnpy3k
-warnpy3k("In 3.x, the SystemEvents package is removed.")
+warnpy3k("In 3.x, the SystemEvents package is removed.", stacklevel=2)
import aetools
Error = aetools.Error
Modified: python/trunk/Lib/plat-mac/lib-scriptpackages/Terminal/__init__.py
==============================================================================
--- python/trunk/Lib/plat-mac/lib-scriptpackages/Terminal/__init__.py (original)
+++ python/trunk/Lib/plat-mac/lib-scriptpackages/Terminal/__init__.py Mon Jul 14 19:42:17 2008
@@ -3,7 +3,7 @@
"""
from warnings import warnpy3k
-warnpy3k("In 3.x, the Terminal module is removed.")
+warnpy3k("In 3.x, the Terminal module is removed.", stacklevel=2)
import aetools
Error = aetools.Error
Modified: python/trunk/Lib/plat-mac/lib-scriptpackages/_builtinSuites/__init__.py
==============================================================================
--- python/trunk/Lib/plat-mac/lib-scriptpackages/_builtinSuites/__init__.py (original)
+++ python/trunk/Lib/plat-mac/lib-scriptpackages/_builtinSuites/__init__.py Mon Jul 14 19:42:17 2008
@@ -6,7 +6,7 @@
"""
from warnings import warnpy3k
-warnpy3k("In 3.x, the _builtinSuites module is removed.")
+warnpy3k("In 3.x, the _builtinSuites module is removed.", stacklevel=2)
import aetools
import builtin_Suite
Modified: python/trunk/Lib/plat-mac/macerrors.py
==============================================================================
--- python/trunk/Lib/plat-mac/macerrors.py (original)
+++ python/trunk/Lib/plat-mac/macerrors.py Mon Jul 14 19:42:17 2008
@@ -1,7 +1,7 @@
# -coding=latin1-
from warnings import warnpy3k
-warnpy3k("In 3.x, the macerrors module is removed.")
+warnpy3k("In 3.x, the macerrors module is removed.", stacklevel=2)
svTempDisable = -32768 #svTempDisable
svDisabled = -32640 #Reserve range -32640 to -32768 for Apple temp disables.
Modified: python/trunk/Lib/plat-mac/macostools.py
==============================================================================
--- python/trunk/Lib/plat-mac/macostools.py (original)
+++ python/trunk/Lib/plat-mac/macostools.py Mon Jul 14 19:42:17 2008
@@ -5,7 +5,7 @@
"""
from warnings import warnpy3k
-warnpy3k("In 3.x, the macostools module is removed.")
+warnpy3k("In 3.x, the macostools module is removed.", stacklevel=2)
from Carbon import Res
from Carbon import File, Files
Modified: python/trunk/Lib/plat-mac/macresource.py
==============================================================================
--- python/trunk/Lib/plat-mac/macresource.py (original)
+++ python/trunk/Lib/plat-mac/macresource.py Mon Jul 14 19:42:17 2008
@@ -1,7 +1,7 @@
"""macresource - Locate and open the resources needed for a script."""
from warnings import warnpy3k
-warnpy3k("In 3.x, the macresource module is removed.")
+warnpy3k("In 3.x, the macresource module is removed.", stacklevel=2)
from Carbon import Res
import os
Modified: python/trunk/Lib/plat-mac/pimp.py
==============================================================================
--- python/trunk/Lib/plat-mac/pimp.py (original)
+++ python/trunk/Lib/plat-mac/pimp.py Mon Jul 14 19:42:17 2008
@@ -14,7 +14,7 @@
"""
from warnings import warnpy3k
-warnpy3k("In 3.x, the pimp module is removed.")
+warnpy3k("In 3.x, the pimp module is removed.", stacklevel=2)
import sys
import os
Modified: python/trunk/Lib/plat-mac/terminalcommand.py
==============================================================================
--- python/trunk/Lib/plat-mac/terminalcommand.py (original)
+++ python/trunk/Lib/plat-mac/terminalcommand.py Mon Jul 14 19:42:17 2008
@@ -15,7 +15,7 @@
#
from warnings import warnpy3k
-warnpy3k("In 3.x, the terminalcommand module is removed.")
+warnpy3k("In 3.x, the terminalcommand module is removed.", stacklevel=2)
import time
import os
Modified: python/trunk/Lib/plat-mac/videoreader.py
==============================================================================
--- python/trunk/Lib/plat-mac/videoreader.py (original)
+++ python/trunk/Lib/plat-mac/videoreader.py Mon Jul 14 19:42:17 2008
@@ -7,7 +7,7 @@
#
from warnings import warnpy3k
-warnpy3k("In 3.x, the videoreader module is removed.")
+warnpy3k("In 3.x, the videoreader module is removed.", stacklevel=2)
import sys
Modified: python/trunk/Lib/rfc822.py
==============================================================================
--- python/trunk/Lib/rfc822.py (original)
+++ python/trunk/Lib/rfc822.py Mon Jul 14 19:42:17 2008
@@ -74,7 +74,8 @@
import time
from warnings import warnpy3k
-warnpy3k("in 3.x, rfc822 has been removed in favor of the email package")
+warnpy3k("in 3.x, rfc822 has been removed in favor of the email package",
+ stacklevel=2)
__all__ = ["Message","AddressList","parsedate","parsedate_tz","mktime_tz"]
Modified: python/trunk/Lib/test/test_py3kwarn.py
==============================================================================
--- python/trunk/Lib/test/test_py3kwarn.py (original)
+++ python/trunk/Lib/test/test_py3kwarn.py Mon Jul 14 19:42:17 2008
@@ -4,6 +4,8 @@
TestSkipped, run_unittest)
import warnings
+from contextlib import nested
+
if not sys.py3kwarning:
raise TestSkipped('%s must be run with the -3 flag' % __name__)
@@ -193,7 +195,7 @@
'Explorer', 'Finder', 'Netscape',
'StdSuites', 'SystemEvents', 'Terminal',
'cfmfile', 'bundlebuilder', 'buildtools',
- 'ColorPicker'),
+ 'ColorPicker', 'Audio_mac'),
'sunos5' : ('sunaudiodev', 'SUNAUDIODEV'),
}
optional_modules = ('bsddb185', 'Canvas', 'dl', 'linuxaudiodev', 'imageop',
@@ -202,23 +204,22 @@
def check_removal(self, module_name, optional=False):
"""Make sure the specified module, when imported, raises a
DeprecationWarning and specifies itself in the message."""
- with CleanImport(module_name):
- with catch_warning(record=False):
- warnings.filterwarnings("error", ".+ removed",
- DeprecationWarning)
- try:
- __import__(module_name, level=0)
- except DeprecationWarning as exc:
- self.assert_(module_name in exc.args[0],
- "%s warning didn't contain module name"
- % module_name)
- except ImportError:
- if not optional:
- self.fail("Non-optional module {0} raised an "
- "ImportError.".format(module_name))
- else:
- self.fail("DeprecationWarning not raised for {0}"
- .format(module_name))
+ with nested(CleanImport(module_name), catch_warning(record=False)):
+ warnings.filterwarnings("error", ".+ removed",
+ DeprecationWarning, __name__)
+ try:
+ __import__(module_name, level=0)
+ except DeprecationWarning as exc:
+ self.assert_(module_name in exc.args[0],
+ "%s warning didn't contain module name"
+ % module_name)
+ except ImportError:
+ if not optional:
+ self.fail("Non-optional module {0} raised an "
+ "ImportError.".format(module_name))
+ else:
+ self.fail("DeprecationWarning not raised for {0}"
+ .format(module_name))
def test_platform_independent_removals(self):
# Make sure that the modules that are available on all platforms raise
More information about the Python-checkins
mailing list