-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-101100: Fix dangling references in test.rst #114958
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
cbd26fc
b9d12fd
a6cb747
2d479c6
f2252d0
cccb427
c23ac54
b3acb26
38194c5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -169,7 +169,7 @@ test.regrtest` used in previous Python versions still works. Running the | |
script by itself automatically starts running all regression tests in the | ||
:mod:`test` package. It does this by finding all modules in the package whose | ||
name starts with ``test_``, importing them, and executing the function | ||
:func:`test_main` if present or loading the tests via | ||
``test_main`` if present or loading the tests via | ||
unittest.TestLoader.loadTestsFromModule if ``test_main`` does not exist. The | ||
names of tests to execute may also be passed to the script. Specifying a single | ||
regression test (:program:`python -m test test_spam`) will minimize output and | ||
|
@@ -324,9 +324,9 @@ The :mod:`test.support` module defines the following constants: | |
|
||
.. data:: Py_DEBUG | ||
|
||
True if Python was built with the :c:macro:`Py_DEBUG` macro | ||
defined, that is, if | ||
Python was :ref:`built in debug mode <debug-build>`. | ||
True if Python was built with the :c:macro:`Py_DEBUG` macro defined; | ||
that is, if Python was :ref:`built in debug mode <debug-build>` | ||
(:option:`./configure --with-pydebug <--with-pydebug>`). | ||
|
||
.. versionadded:: 3.12 | ||
|
||
|
@@ -475,7 +475,7 @@ The :mod:`test.support` module defines the following functions: | |
|
||
.. function:: with_pymalloc() | ||
|
||
Return :const:`_testcapi.WITH_PYMALLOC`. | ||
Return :const:`!_testcapi.WITH_PYMALLOC`. | ||
|
||
|
||
.. function:: requires(resource, msg=None) | ||
|
@@ -969,7 +969,7 @@ The :mod:`test.support` module defines the following functions: | |
|
||
.. function:: skip_if_broken_multiprocessing_synchronize() | ||
|
||
Skip tests if the :mod:`multiprocessing.synchronize` module is missing, if | ||
Skip tests if the :mod:`!multiprocessing.synchronize` module is missing, if | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is an purposefully undocumented module, I'm guessing? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I couldn't begin to guess why it's undocumented. Maybe it's meant to be semantically identical to the relevant
I see this comment preceding an import which it suggests might fail:
There is also a note about this possibility in the |
||
there is no available semaphore implementation, or if creating a lock raises | ||
an :exc:`OSError`. | ||
|
||
|
@@ -1087,12 +1087,12 @@ The :mod:`test.support.socket_helper` module provides support for socket tests. | |
buildbot environment. This method raises an exception if the | ||
``sock.family`` is :const:`~socket.AF_INET` and ``sock.type`` is | ||
:const:`~socket.SOCK_STREAM`, and the socket has | ||
:const:`~socket.SO_REUSEADDR` or :const:`~socket.SO_REUSEPORT` set on it. | ||
:const:`!SO_REUSEADDR` or :const:`!SO_REUSEPORT` set on it. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The better way to fix these two warnings would be to add documentation for these constants in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps, but ISTR the I understand it would be great to have the Python library docs completely self-contained, but I don't think that's the best way to go in some cases. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair point, there are probably too many in the socket module for us to list them all out explicitly! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In that case, we should explicitly list them in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given that many of the possible constants are only given in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This stuff is really at the fringe between low-level Unix stuff and the relevant Python wrappers. According to Wikipedia, the first edition of Stevens' Unix Network Programming (the network programming bible when I was a wee lad) is 768 pages long. It's not at all clear to me that there's much to be gained by documenting a few socket options. It's not really going to flatten the socket programming learning curve much. Programmers will have to delve into the C socket documentation to do anything serious anyway. Sorry about the soapbox. |
||
Tests should never set these socket options for TCP/IP sockets. | ||
The only case for setting these options is testing multicasting via | ||
multiple UDP sockets. | ||
|
||
Additionally, if the :const:`~socket.SO_EXCLUSIVEADDRUSE` socket option is | ||
Additionally, if the :const:`!~socket.SO_EXCLUSIVEADDRUSE` socket option is | ||
available (i.e. on Windows), it will be set on the socket. This will | ||
prevent anyone else from binding to our host/port for the duration of the | ||
test. | ||
|
@@ -1141,7 +1141,7 @@ script execution tests. | |
doesn't have an obvious home with Python's current home finding logic. | ||
|
||
Setting :envvar:`PYTHONHOME` is one way to get most of the testsuite to run | ||
in that situation. :envvar:`PYTHONPATH` or :envvar:`PYTHONUSERSITE` are | ||
in that situation. :envvar:`PYTHONPATH` or :envvar:`PYTHONNOUSERSITE` are | ||
other common environment variables that might impact whether or not the | ||
interpreter can start. | ||
|
||
|
@@ -1553,7 +1553,7 @@ The :mod:`test.support.import_helper` module provides support for import tests. | |
|
||
This function imports and returns a fresh copy of the named Python module | ||
by removing the named module from ``sys.modules`` before doing the import. | ||
Note that unlike :func:`reload`, the original module is not affected by | ||
Note that unlike :func:`importlib.reload`, the original module is not affected by | ||
this operation. | ||
|
||
*fresh* is an iterable of additional module names that are also removed | ||
|
@@ -1716,16 +1716,16 @@ The :mod:`test.support.warnings_helper` module provides support for warnings tes | |
|
||
In this case all warnings are caught and no errors are raised. | ||
|
||
On entry to the context manager, a :class:`WarningRecorder` instance is | ||
On entry to the context manager, a :class:`WarningsRecorder` instance is | ||
returned. The underlying warnings list from | ||
:func:`~warnings.catch_warnings` is available via the recorder object's | ||
:attr:`warnings` attribute. As a convenience, the attributes of the object | ||
:attr:`WarningsRecorder.warnings` attribute. As a convenience, the attributes of the object | ||
representing the most recent warning can also be accessed directly through | ||
the recorder object (see example below). If no warning has been raised, | ||
then any of the attributes that would otherwise be expected on an object | ||
representing a warning will return ``None``. | ||
|
||
The recorder object also has a :meth:`reset` method, which clears the | ||
The recorder object also has a :meth:`WarningsRecorder.reset` method, which clears the | ||
warnings list. | ||
|
||
The context manager is designed to be used like this:: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a constant in an underscored name, test module, so it's not required to document it, but given the entire description of this function is "return ", which doesn't seem terribly useful if said constant is entirely undocumented, it seems worth at least briefly touching on what that actually means here (which the warning is a canary for).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing the reference must be suppressed in some other way, because no hyperlink shows up in the generated HTML (and no warning is emitted by Sphinx). You'll have to take this up with someone above my pay grade.