Skip to content

Commit 54f8aa8

Browse files
miss-islingtonsmontanaroCAM-Gerlachambv
authored
[3.14] gh-151950: Fix dangling references in test.rst (GH-114958) (#160117)
(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 2b1b7ca commit 54f8aa8

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
@@ -213,6 +213,10 @@
213213
('c:macro', 'LONG_MIN'),
214214
# Standard C variables
215215
('c:data', 'errno'),
216+
# Platform-specific socket constants documented collectively as SO_*.
217+
('py:const', 'socket.SO_EXCLUSIVEADDRUSE'),
218+
('py:const', 'socket.SO_REUSEADDR'),
219+
('py:const', 'socket.SO_REUSEPORT'),
216220
# Standard environment variables
217221
('envvar', 'BROWSER'),
218222
('envvar', 'COLUMNS'),

‎Doc/library/test.rst‎

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

508508
.. function:: with_pymalloc()
509509

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

512513

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

10901091
.. function:: skip_if_broken_multiprocessing_synchronize()
10911092

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

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

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

@@ -1683,8 +1684,8 @@ The :mod:`!test.support.import_helper` module provides support for import tests.
16831684

16841685
This function imports and returns a fresh copy of the named Python module
16851686
by removing the named module from ``sys.modules`` before doing the import.
1686-
Note that unlike :func:`reload`, the original module is not affected by
1687-
this operation.
1687+
Note that unlike :func:`importlib.reload`, the original module is not
1688+
affected by this operation.
16881689

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

18471848
In this case all warnings are caught and no errors are raised.
18481849

1849-
On entry to the context manager, a :class:`WarningRecorder` instance is
1850-
returned. The underlying warnings list from
1851-
:func:`~warnings.catch_warnings` is available via the recorder object's
1852-
:attr:`warnings` attribute. As a convenience, the attributes of the object
1853-
representing the most recent warning can also be accessed directly through
1854-
the recorder object (see example below). If no warning has been raised,
1855-
then any of the attributes that would otherwise be expected on an object
1856-
representing a warning will return ``None``.
1857-
1858-
The recorder object also has a :meth:`reset` method, which clears the
1859-
warnings list.
1850+
On entry to the context manager, a :class:`WarningsRecorder` instance is
1851+
returned. The recorded warnings are available via its
1852+
:attr:`~WarningsRecorder.warnings` attribute, and its
1853+
:meth:`~WarningsRecorder.reset` method discards previously recorded warnings.
18601854

18611855
The context manager is designed to be used like this::
18621856

@@ -1873,11 +1867,11 @@ The :mod:`!test.support.warnings_helper` module provides support for warnings te
18731867

18741868
with check_warnings(quiet=True) as w:
18751869
warnings.warn("foo")
1876-
assert str(w.args[0]) == "foo"
1870+
assert str(w.message) == "foo"
18771871
warnings.warn("bar")
1878-
assert str(w.args[0]) == "bar"
1879-
assert str(w.warnings[0].args[0]) == "foo"
1880-
assert str(w.warnings[1].args[0]) == "bar"
1872+
assert str(w.message) == "bar"
1873+
assert str(w.warnings[0].message) == "foo"
1874+
assert str(w.warnings[1].message) == "bar"
18811875
w.reset()
18821876
assert len(w.warnings) == 0
18831877

@@ -1889,7 +1883,22 @@ The :mod:`!test.support.warnings_helper` module provides support for warnings te
18891883
New optional arguments *filters* and *quiet*.
18901884

18911885

1892-
.. class:: WarningsRecorder()
1886+
.. class:: WarningsRecorder(warnings_list)
1887+
1888+
Class used to record warnings for unit tests. Wraps the warnings list
1889+
returned by :func:`warnings.catch_warnings` when recording is enabled.
1890+
:func:`check_warnings` returns an instance of this class.
1891+
1892+
As a convenience, the attributes of the object representing the most recent
1893+
warning can also be accessed directly through the recorder object.
1894+
If no warning has been raised since the recorder was created or last reset,
1895+
these attributes return ``None``.
1896+
1897+
.. attribute:: warnings
1898+
1899+
A list of warnings recorded since the recorder was created or last reset.
1900+
1901+
.. method:: reset()
18931902

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

‎Doc/tools/.nitignore‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ Doc/library/select.rst
1919
Doc/library/socket.rst
2020
Doc/library/ssl.rst
2121
Doc/library/termios.rst
22-
Doc/library/test.rst
2322
Doc/library/urllib.parse.rst
2423
Doc/library/urllib.request.rst
2524
Doc/library/wsgiref.rst

‎Doc/using/configure.rst‎

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

774-
Don't define the ``WITH_DOC_STRINGS`` macro.
774+
Don't define the :c:macro:`WITH_DOC_STRINGS` macro.
775+
776+
.. c:macro:: WITH_DOC_STRINGS
777+
778+
Define this macro to include static documentation strings in the build.
779+
It is defined by default, unless :option:`--without-doc-strings` is used.
775780

776781
See the ``PyDoc_STRVAR()`` macro.
777782

0 commit comments

Comments
 (0)