From b8c5f54248369ff89575c1416a98e13e718a4aa4 Mon Sep 17 00:00:00 2001 From: Martin Panter Date: Sun, 30 Oct 2016 04:20:23 +0000 Subject: [PATCH] =?UTF-8?q?Issue=20#26638:=20Work=20around=20more=20CLI=20?= =?UTF-8?q?options=20that=20can=E2=80=99t=20be=20linked?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Cannot seem to link directly to main options from the “unittest” module, because that module has its own set of options * Mask out linking for options that no longer exist in Python 3 --- Doc/library/unittest.rst | 6 ++++-- Doc/using/cmdline.rst | 1 + Doc/whatsnew/2.2.rst | 2 +- Doc/whatsnew/2.6.rst | 4 ++-- Doc/whatsnew/2.7.rst | 4 ++-- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst index b9b339b7619..ac1224cdbff 100644 --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -1972,7 +1972,8 @@ Loading and running tests methods ` are also special-cased and, when the warning filters are ``'default'`` or ``'always'``, they will appear only once per-module, in order to avoid too many warning messages. This behavior can - be overridden using the :option:`-Wd` or :option:`-Wa` options and leaving + be overridden using Python's :option:`!-Wd` or :option:`!-Wa` options + (see :ref:`Warning control `) and leaving *warnings* to ``None``. .. versionchanged:: 3.2 @@ -2053,7 +2054,8 @@ Loading and running tests The *warnings* argument specifies the :ref:`warning filter ` that should be used while running the tests. If it's not specified, it will - remain ``None`` if a :option:`-W` option is passed to :program:`python`, + remain ``None`` if a :option:`!-W` option is passed to :program:`python` + (see :ref:`Warning control `), otherwise it will be set to ``'default'``. Calling ``main`` actually returns an instance of the ``TestProgram`` class. diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst index 7b42da2dbab..611779618e7 100644 --- a/Doc/using/cmdline.rst +++ b/Doc/using/cmdline.rst @@ -313,6 +313,7 @@ Miscellaneous options See also :envvar:`PYTHONVERBOSE`. +.. _using-on-warnings: .. cmdoption:: -W arg Warning control. Python's warning machinery by default prints warning diff --git a/Doc/whatsnew/2.2.rst b/Doc/whatsnew/2.2.rst index d27b937a81c..5f28c29443d 100644 --- a/Doc/whatsnew/2.2.rst +++ b/Doc/whatsnew/2.2.rst @@ -758,7 +758,7 @@ Here are the changes 2.2 introduces: operators. * Python 2.2 supports some command-line arguments for testing whether code will - work with the changed division semantics. Running python with :option:`-Q + work with the changed division semantics. Running python with :option:`!-Q warn` will cause a warning to be issued whenever division is applied to two integers. You can use this to find code that's affected by the change and fix it. By default, Python 2.2 will simply perform classic division without a diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst index f7f03d009f0..35931de73fb 100644 --- a/Doc/whatsnew/2.6.rst +++ b/Doc/whatsnew/2.6.rst @@ -58,7 +58,7 @@ Python 2.6 incorporates new features and syntax from 3.0 while remaining compatible with existing code by not removing older features or syntax. When it's not possible to do that, Python 2.6 tries to do what it can, adding compatibility functions in a -:mod:`future_builtins` module and a :option:`-3` switch to warn about +:mod:`future_builtins` module and a :option:`!-3` switch to warn about usages that will become unsupported in 3.0. Some significant new packages have been added to the standard library, @@ -116,7 +116,7 @@ module has versions with the new 3.0 semantics. Code written to be compatible with 3.0 can do ``from future_builtins import hex, map`` as necessary. -A new command-line switch, :option:`-3`, enables warnings +A new command-line switch, :option:`!-3`, enables warnings about features that will be removed in Python 3.0. You can run code with this switch to see how much work will be necessary to port code to 3.0. The value of this switch is available diff --git a/Doc/whatsnew/2.7.rst b/Doc/whatsnew/2.7.rst index 3e5d434459c..ad0616bc23e 100644 --- a/Doc/whatsnew/2.7.rst +++ b/Doc/whatsnew/2.7.rst @@ -198,8 +198,8 @@ Other new Python3-mode warnings include: * :func:`operator.isCallable` and :func:`operator.sequenceIncludes`, which are not supported in 3.x, now trigger warnings. -* The :option:`-3` switch now automatically - enables the :option:`-Qwarn <-Q>` switch that causes warnings +* The :option:`!-3` switch now automatically + enables the :option:`!-Qwarn` switch that causes warnings about using classic division with integers and long integers.