Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b8c5f54

Browse files
committed
Issue #26638: Work around more CLI options that can’t be linked
* 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
1 parent 5c67933 commit b8c5f54

5 files changed

Lines changed: 10 additions & 7 deletions

File tree

Doc/library/unittest.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1972,7 +1972,8 @@ Loading and running tests
19721972
methods <deprecated-aliases>` are also special-cased and, when the warning
19731973
filters are ``'default'`` or ``'always'``, they will appear only once
19741974
per-module, in order to avoid too many warning messages. This behavior can
1975-
be overridden using the :option:`-Wd` or :option:`-Wa` options and leaving
1975+
be overridden using Python's :option:`!-Wd` or :option:`!-Wa` options
1976+
(see :ref:`Warning control <using-on-warnings>`) and leaving
19761977
*warnings* to ``None``.
19771978

19781979
.. versionchanged:: 3.2
@@ -2053,7 +2054,8 @@ Loading and running tests
20532054

20542055
The *warnings* argument specifies the :ref:`warning filter <warning-filter>`
20552056
that should be used while running the tests. If it's not specified, it will
2056-
remain ``None`` if a :option:`-W` option is passed to :program:`python`,
2057+
remain ``None`` if a :option:`!-W` option is passed to :program:`python`
2058+
(see :ref:`Warning control <using-on-warnings>`),
20572059
otherwise it will be set to ``'default'``.
20582060

20592061
Calling ``main`` actually returns an instance of the ``TestProgram`` class.

Doc/using/cmdline.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ Miscellaneous options
313313
See also :envvar:`PYTHONVERBOSE`.
314314

315315

316+
.. _using-on-warnings:
316317
.. cmdoption:: -W arg
317318

318319
Warning control. Python's warning machinery by default prints warning

Doc/whatsnew/2.2.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ Here are the changes 2.2 introduces:
758758
operators.
759759

760760
* Python 2.2 supports some command-line arguments for testing whether code will
761-
work with the changed division semantics. Running python with :option:`-Q
761+
work with the changed division semantics. Running python with :option:`!-Q
762762
warn` will cause a warning to be issued whenever division is applied to two
763763
integers. You can use this to find code that's affected by the change and fix
764764
it. By default, Python 2.2 will simply perform classic division without a

Doc/whatsnew/2.6.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Python 2.6 incorporates new features and syntax from 3.0 while
5858
remaining compatible with existing code by not removing older features
5959
or syntax. When it's not possible to do that, Python 2.6 tries to do
6060
what it can, adding compatibility functions in a
61-
:mod:`future_builtins` module and a :option:`-3` switch to warn about
61+
:mod:`future_builtins` module and a :option:`!-3` switch to warn about
6262
usages that will become unsupported in 3.0.
6363

6464
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
116116
compatible with 3.0 can do ``from future_builtins import hex, map`` as
117117
necessary.
118118

119-
A new command-line switch, :option:`-3`, enables warnings
119+
A new command-line switch, :option:`!-3`, enables warnings
120120
about features that will be removed in Python 3.0. You can run code
121121
with this switch to see how much work will be necessary to port
122122
code to 3.0. The value of this switch is available

Doc/whatsnew/2.7.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ Other new Python3-mode warnings include:
198198

199199
* :func:`operator.isCallable` and :func:`operator.sequenceIncludes`,
200200
which are not supported in 3.x, now trigger warnings.
201-
* The :option:`-3` switch now automatically
202-
enables the :option:`-Qwarn <-Q>` switch that causes warnings
201+
* The :option:`!-3` switch now automatically
202+
enables the :option:`!-Qwarn` switch that causes warnings
203203
about using classic division with integers and long integers.
204204

205205

0 commit comments

Comments
 (0)