summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-05-26 19:41:53 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-05-26 19:41:53 (GMT)
commit3aa84a7f28659cfbed312e352775b32d2a58005b (patch)
treedbf35ab7618666913f26a95a44fd1c51d7d3c93d
parentb17ad2de08f1d31767255879664ba671cb20f000 (diff)
downloadcpython-3aa84a7f28659cfbed312e352775b32d2a58005b.zip
cpython-3aa84a7f28659cfbed312e352775b32d2a58005b.tar.gz
cpython-3aa84a7f28659cfbed312e352775b32d2a58005b.tar.bz2
warn about some members of the commands module
-rw-r--r--Doc/library/commands.rst8
-rw-r--r--Lib/commands.py4
-rw-r--r--Lib/test/test_py3kwarn.py9
3 files changed, 20 insertions, 1 deletions
diff --git a/Doc/library/commands.rst b/Doc/library/commands.rst
index 177710b..c3f7710 100644
--- a/Doc/library/commands.rst
+++ b/Doc/library/commands.rst
@@ -42,7 +42,13 @@ The :mod:`commands` module defines the following functions:
.. deprecated:: 2.6
This function is nonobvious and useless, also the name is misleading in the
- presence of :func:`getstatusoutput`.
+ presence of :func:`getstatusoutput`. It is removed in 3.x.
+
+.. warning::
+
+ Two undocumented functions in this module, :func:`mk2arg` and :func:`mkargs`
+ are removed in 3.x.
+
Example::
diff --git a/Lib/commands.py b/Lib/commands.py
index d19aa1a..b4e1d3c 100644
--- a/Lib/commands.py
+++ b/Lib/commands.py
@@ -63,6 +63,8 @@ def getstatusoutput(cmd):
# Make command argument from directory and pathname (prefix space, add quotes).
#
def mk2arg(head, x):
+ from warnings import warnpy3k
+ warnpy3k("In 3.x, mk2arg is removed.")
import os
return mkarg(os.path.join(head, x))
@@ -75,6 +77,8 @@ def mk2arg(head, x):
# with backslash.
#
def mkarg(x):
+ from warnings import warnpy3k
+ warnpy3k("in 3.x, mkarg is remove.")
if '\'' not in x:
return ' \'' + x + '\''
s = ' "'
diff --git a/Lib/test/test_py3kwarn.py b/Lib/test/test_py3kwarn.py
index 180342b..d5574f4 100644
--- a/Lib/test/test_py3kwarn.py
+++ b/Lib/test/test_py3kwarn.py
@@ -212,6 +212,15 @@ class TestStdlibRemovals(unittest.TestCase):
mod.walk(".", dumbo, None)
self.assertEquals(str(w.message), msg)
+ def test_commands_members(self):
+ import commands
+ members = {"mk2arg" : 2, "mkarg" : 1, "getstatus" : 1}
+ for name, arg_count in members.items():
+ with catch_warning(record=False):
+ warnings.filterwarnings("error")
+ func = getattr(commands, name)
+ self.assertRaises(DeprecationWarning, func, *([None]*arg_count))
+
def test_main():
run_unittest(TestPy3KWarnings,