summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2008-05-06 23:23:34 (GMT)
committerBrett Cannon <bcannon@gmail.com>2008-05-06 23:23:34 (GMT)
commite5d2cbaeaf58c643674a2869294d90314132273c (patch)
tree43aaa1335ba9d4f0b9362cfae150be7ca09aaebc
parent79618239d144d8e824bac176c95dfb9f0212b224 (diff)
downloadcpython-e5d2cbaeaf58c643674a2869294d90314132273c.zip
cpython-e5d2cbaeaf58c643674a2869294d90314132273c.tar.gz
cpython-e5d2cbaeaf58c643674a2869294d90314132273c.tar.bz2
Deprecate the audiodev module for 3.0.
-rw-r--r--Doc/library/undoc.rst2
-rw-r--r--Lib/audiodev.py3
-rw-r--r--Lib/test/test_py3kwarn.py36
3 files changed, 40 insertions, 1 deletions
diff --git a/Doc/library/undoc.rst b/Doc/library/undoc.rst
index c316e32..62efc18 100644
--- a/Doc/library/undoc.rst
+++ b/Doc/library/undoc.rst
@@ -47,6 +47,8 @@ Multimedia
:mod:`audiodev`
--- Platform-independent API for playing audio data.
+ .. warning:: The :mod:`audiodev` module has been removed in 3.0.
+
:mod:`linuxaudiodev`
--- Play audio data on the Linux audio device. Replaced in Python 2.3 by the
:mod:`ossaudiodev` module.
diff --git a/Lib/audiodev.py b/Lib/audiodev.py
index 8945c98..b6831a6 100644
--- a/Lib/audiodev.py
+++ b/Lib/audiodev.py
@@ -1,4 +1,7 @@
"""Classes for manipulating audio devices (currently only for Sun and SGI)"""
+from warnings import warnpy3k
+warnpy3k("the audiodev module has been removed in Python 3.0", stacklevel=2)
+del warnpy3k
__all__ = ["error","AudioDev"]
diff --git a/Lib/test/test_py3kwarn.py b/Lib/test/test_py3kwarn.py
index 5766e61..2850bf2 100644
--- a/Lib/test/test_py3kwarn.py
+++ b/Lib/test/test_py3kwarn.py
@@ -124,8 +124,42 @@ class TestPy3KWarnings(unittest.TestCase):
self.assertWarning(buffer('a'), w, expected)
+class TestStdlibRemovals(unittest.TestCase):
+
+ all_platforms = ('audiodev',)
+
+ def check_removal(self, module_name):
+ """Make sure the specified module, when imported, raises a
+ DeprecationWarning and specifies itself in the message."""
+ original_module = None
+ if module_name in sys.modules:
+ original_module = sys.modules[module_name]
+ del sys.modules[module_name]
+ try:
+ with catch_warning() as w:
+ warnings.filterwarnings("error", ".+ removed",
+ DeprecationWarning)
+ try:
+ __import__(module_name, level=0)
+ except DeprecationWarning as exc:
+ self.assert_(module_name in exc.args[0])
+ else:
+ self.fail("DeprecationWarning not raised for %s" %
+ module_name)
+ finally:
+ if original_module:
+ sys.modules[module_name] = original_module
+
+
+ def test_platform_independent_removals(self):
+ # Make sure that the modules that are available on all platforms raise
+ # the proper DeprecationWarning.
+ for module_name in self.all_platforms:
+ self.check_removal(module_name)
+
+
def test_main():
- run_unittest(TestPy3KWarnings)
+ run_unittest(TestPy3KWarnings, TestStdlibRemovals)
if __name__ == '__main__':
test_main()