]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
warn about some members of the commands module
authorBenjamin Peterson <benjamin@python.org>
Mon, 26 May 2008 19:41:53 +0000 (19:41 +0000)
committerBenjamin Peterson <benjamin@python.org>
Mon, 26 May 2008 19:41:53 +0000 (19:41 +0000)
Doc/library/commands.rst
Lib/commands.py
Lib/test/test_py3kwarn.py

index 177710b5676d5b183ae57de89792ac7742aec96d..c3f771085e0193d318a76d7cf1e698537938276f 100644 (file)
@@ -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::
 
index d19aa1a480ac3374cbc333f132c60fcca8043b61..b4e1d3c0f6ad24daaccf0784f8ecadebc8a39a30 100644 (file)
@@ -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 = ' "'
index 180342b3d0cb62c40bbf701b1ce5aba818254966..d5574f499cdbb364e9d3af74ff695dfd1de75455 100644 (file)
@@ -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,