Skip to content

Commit 4ac146b

Browse files
miss-islingtonsmontanaroCAM-Gerlachambv
authored
[3.15] gh-151950: Fix dangling references in test.rst (GH-114958) (#160116)
(cherry picked from commit 4372120) Co-authored-by: Muse Code (Meta Muse Spark) Co-authored-by: Skip Montanaro <skip.montanaro@gmail.com> Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM> Co-authored-by: Lukasz Langa <ambv@meta.com>
1 parent 1fc8493 commit 4ac146b

4 files changed

Lines changed: 42 additions & 25 deletions

File tree

‎Doc/conf.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@
214214
('c:macro', 'LONG_MIN'),
215215
# Standard C variables
216216
('c:data', 'errno'),
217+
# Platform-specific socket constants documented collectively as SO_*.
218+
('py:const', 'socket.SO_EXCLUSIVEADDRUSE'),
219+
('py:const', 'socket.SO_REUSEADDR'),
220+
('py:const', 'socket.SO_REUSEPORT'),
217221
# Standard environment variables
218222
('envvar', 'BROWSER'),
219223
('envvar', 'COLUMNS'),

‎Doc/library/test.rst‎

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,8 @@ The :mod:`!test.support` module defines the following functions:
505505

506506
.. function:: with_pymalloc()
507507

508-
Return :const:`_testcapi.WITH_PYMALLOC`.
508+
Return ``True`` if Python was built with :ref:`pymalloc <pymalloc>` enabled
509+
and is not a :term:`free-threaded build`.
509510

510511

511512
.. function:: requires(resource, msg=None)
@@ -1087,7 +1088,7 @@ The :mod:`!test.support` module defines the following functions:
10871088

10881089
.. function:: skip_if_broken_multiprocessing_synchronize()
10891090

1090-
Skip tests if the :mod:`multiprocessing.synchronize` module is missing, if
1091+
Skip tests if the :mod:`!multiprocessing.synchronize` module is missing, if
10911092
there is no available semaphore implementation, or if creating a lock raises
10921093
an :exc:`OSError`.
10931094

@@ -1259,7 +1260,7 @@ script execution tests.
12591260
doesn't have an obvious home with Python's current home finding logic.
12601261

12611262
Setting :envvar:`PYTHONHOME` is one way to get most of the testsuite to run
1262-
in that situation. :envvar:`PYTHONPATH` or :envvar:`PYTHONUSERSITE` are
1263+
in that situation. :envvar:`PYTHONPATH` or :envvar:`PYTHONNOUSERSITE` are
12631264
other common environment variables that might impact whether or not the
12641265
interpreter can start.
12651266

@@ -1707,8 +1708,8 @@ The :mod:`!test.support.import_helper` module provides support for import tests.
17071708

17081709
This function imports and returns a fresh copy of the named Python module
17091710
by removing the named module from ``sys.modules`` before doing the import.
1710-
Note that unlike :func:`reload`, the original module is not affected by
1711-
this operation.
1711+
Note that unlike :func:`importlib.reload`, the original module is not
1712+
affected by this operation.
17121713

17131714
*fresh* is an iterable of additional module names that are also removed
17141715
from the ``sys.modules`` cache before doing the import.
@@ -1870,17 +1871,10 @@ The :mod:`!test.support.warnings_helper` module provides support for warnings te
18701871

18711872
In this case all warnings are caught and no errors are raised.
18721873

1873-
On entry to the context manager, a :class:`WarningRecorder` instance is
1874-
returned. The underlying warnings list from
1875-
:func:`~warnings.catch_warnings` is available via the recorder object's
1876-
:attr:`warnings` attribute. As a convenience, the attributes of the object
1877-
representing the most recent warning can also be accessed directly through
1878-
the recorder object (see example below). If no warning has been raised,
1879-
then any of the attributes that would otherwise be expected on an object
1880-
representing a warning will return ``None``.
1881-
1882-
The recorder object also has a :meth:`reset` method, which clears the
1883-
warnings list.
1874+
On entry to the context manager, a :class:`WarningsRecorder` instance is
1875+
returned. The recorded warnings are available via its
1876+
:attr:`~WarningsRecorder.warnings` attribute, and its
1877+
:meth:`~WarningsRecorder.reset` method discards previously recorded warnings.
18841878

18851879
The context manager is designed to be used like this::
18861880

@@ -1897,11 +1891,11 @@ The :mod:`!test.support.warnings_helper` module provides support for warnings te
18971891

18981892
with check_warnings(quiet=True) as w:
18991893
warnings.warn("foo")
1900-
assert str(w.args[0]) == "foo"
1894+
assert str(w.message) == "foo"
19011895
warnings.warn("bar")
1902-
assert str(w.args[0]) == "bar"
1903-
assert str(w.warnings[0].args[0]) == "foo"
1904-
assert str(w.warnings[1].args[0]) == "bar"
1896+
assert str(w.message) == "bar"
1897+
assert str(w.warnings[0].message) == "foo"
1898+
assert str(w.warnings[1].message) == "bar"
19051899
w.reset()
19061900
assert len(w.warnings) == 0
19071901

@@ -1913,7 +1907,22 @@ The :mod:`!test.support.warnings_helper` module provides support for warnings te
19131907
New optional arguments *filters* and *quiet*.
19141908

19151909

1916-
.. class:: WarningsRecorder()
1910+
.. class:: WarningsRecorder(warnings_list)
1911+
1912+
Class used to record warnings for unit tests. Wraps the warnings list
1913+
returned by :func:`warnings.catch_warnings` when recording is enabled.
1914+
:func:`check_warnings` returns an instance of this class.
1915+
1916+
As a convenience, the attributes of the object representing the most recent
1917+
warning can also be accessed directly through the recorder object.
1918+
If no warning has been raised since the recorder was created or last reset,
1919+
these attributes return ``None``.
1920+
1921+
.. attribute:: warnings
1922+
1923+
A list of warnings recorded since the recorder was created or last reset.
1924+
1925+
.. method:: reset()
19171926

1918-
Class used to record warnings for unit tests. See documentation of
1919-
:func:`check_warnings` above for more details.
1927+
Discard previously recorded warnings from the recorder's view.
1928+
The underlying warnings list is not modified.

‎Doc/tools/.nitignore‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Doc/library/select.rst
1616
Doc/library/socket.rst
1717
Doc/library/ssl.rst
1818
Doc/library/termios.rst
19-
Doc/library/test.rst
2019
Doc/library/urllib.parse.rst
2120
Doc/library/urllib.request.rst
2221
Doc/library/wsgiref.rst

‎Doc/using/configure.rst‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,12 @@ also be used to improve performance.
866866
Disable static documentation strings to reduce the memory footprint (enabled
867867
by default). Documentation strings defined in Python are not affected.
868868

869-
Don't define the ``WITH_DOC_STRINGS`` macro.
869+
Don't define the :c:macro:`WITH_DOC_STRINGS` macro.
870+
871+
.. c:macro:: WITH_DOC_STRINGS
872+
873+
Define this macro to include static documentation strings in the build.
874+
It is defined by default, unless :option:`--without-doc-strings` is used.
870875

871876
See the ``PyDoc_STRVAR()`` macro.
872877

0 commit comments

Comments
 (0)