Skip to content

Commit 4372120

Browse files
smontanaroCAM-Gerlachambv
authored
gh-151950: Fix dangling references in test.rst (#114958)
Co-authored-by: Muse Code (Meta Muse Spark) Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM> Co-authored-by: Lukasz Langa <ambv@meta.com>
1 parent 134a19e commit 4372120

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
@@ -506,7 +506,8 @@ The :mod:`!test.support` module defines the following functions:
506506

507507
.. function:: with_pymalloc()
508508

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

511512

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

10891090
.. function:: skip_if_broken_multiprocessing_synchronize()
10901091

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

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

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

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

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

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

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

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

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

@@ -1898,11 +1892,11 @@ The :mod:`!test.support.warnings_helper` module provides support for warnings te
18981892

18991893
with check_warnings(quiet=True) as w:
19001894
warnings.warn("foo")
1901-
assert str(w.args[0]) == "foo"
1895+
assert str(w.message) == "foo"
19021896
warnings.warn("bar")
1903-
assert str(w.args[0]) == "bar"
1904-
assert str(w.warnings[0].args[0]) == "foo"
1905-
assert str(w.warnings[1].args[0]) == "bar"
1897+
assert str(w.message) == "bar"
1898+
assert str(w.warnings[0].message) == "foo"
1899+
assert str(w.warnings[1].message) == "bar"
19061900
w.reset()
19071901
assert len(w.warnings) == 0
19081902

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

19161910

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

1919-
Class used to record warnings for unit tests. See documentation of
1920-
:func:`check_warnings` above for more details.
1928+
Discard previously recorded warnings from the recorder's view.
1929+
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
@@ -877,7 +877,12 @@ also be used to improve performance.
877877
Disable static documentation strings to reduce the memory footprint (enabled
878878
by default). Documentation strings defined in Python are not affected.
879879

880-
Don't define the ``WITH_DOC_STRINGS`` macro.
880+
Don't define the :c:macro:`WITH_DOC_STRINGS` macro.
881+
882+
.. c:macro:: WITH_DOC_STRINGS
883+
884+
Define this macro to include static documentation strings in the build.
885+
It is defined by default, unless :option:`--without-doc-strings` is used.
881886

882887
See the ``PyDoc_STRVAR()`` macro.
883888

0 commit comments

Comments
 (0)