Skip to content

Commit f5903c8

Browse files
authored
Merge branch 'main' into fix/156460-asyncmock-callable
2 parents c7fcd7d + 74b944a commit f5903c8

138 files changed

Lines changed: 3946 additions & 1855 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/reusable-check-html-ids.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,6 @@ jobs:
2020
with:
2121
persist-credentials: false
2222
ref: ${{ github.event.pull_request.head.sha }}
23-
- name: 'Downgrade Git'
24-
# Temporarily downgrade to 2.43 until 2.55 is in the runner image,
25-
# to avoid "fatal: shallow file has changed since we read it" bug.
26-
# See https://github.com/python/cpython/issues/151365.
27-
run: |
28-
sudo apt-get install -y --allow-downgrades 'git=1:2.43.*' 'git-man=1:2.43.*'
29-
git --version
3023
- name: 'Find merge base'
3124
id: merge-base
3225
run: |

.github/workflows/reusable-context.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,6 @@ jobs:
9090
|| ''
9191
}}
9292
93-
- name: 'Downgrade Git'
94-
# Temporarily downgrade to 2.43 until 2.55 is in the runner image,
95-
# to avoid "fatal: shallow file has changed since we read it" bug.
96-
# See https://github.com/python/cpython/issues/151365.
97-
if: github.event_name == 'pull_request'
98-
run: |
99-
sudo apt-get install -y --allow-downgrades 'git=1:2.43.*' 'git-man=1:2.43.*'
100-
git --version
101-
10293
# Adapted from https://github.com/actions/checkout/issues/520#issuecomment-1167205721
10394
- name: Fetch commits to get branch diff
10495
if: github.event_name == 'pull_request'

.github/workflows/reusable-docs.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,6 @@ jobs:
4747
&& github.event.pull_request.head.sha
4848
|| ''
4949
}}
50-
- name: 'Downgrade Git'
51-
# Temporarily downgrade to 2.43 until 2.55 is in the runner image,
52-
# to avoid "fatal: shallow file has changed since we read it" bug.
53-
# See https://github.com/python/cpython/issues/151365.
54-
if: github.event_name == 'pull_request'
55-
run: |
56-
sudo apt-get install -y --allow-downgrades 'git=1:2.43.*' 'git-man=1:2.43.*'
57-
git --version
5850
# Adapted from https://github.com/actions/checkout/issues/520#issuecomment-1167205721
5951
- name: 'Fetch commits to get branch diff'
6052
if: github.event_name == 'pull_request'

Doc/library/doctest.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,6 +1162,12 @@ from text files and modules with doctests:
11621162
.. versionchanged:: 3.15
11631163
Run each example as a :ref:`subtest <subtests>`.
11641164

1165+
.. versionchanged:: next
1166+
Report every example, as in verbose mode, if the test runner reports
1167+
more than the test names, i.e. its
1168+
:attr:`~unittest.TestResult.verbosity` is 3 or higher (for example
1169+
with ``python -m unittest -vv``).
1170+
11651171
Under the covers, :func:`DocTestSuite` creates a :class:`unittest.TestSuite` out
11661172
of :class:`!doctest.DocTestCase` instances, and :class:`!DocTestCase` is a
11671173
subclass of :class:`unittest.TestCase`. :class:`!DocTestCase` isn't documented

Doc/library/imaplib.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,20 @@ An :class:`IMAP4` instance has the following methods:
907907

908908
The following attributes are defined on instances of :class:`IMAP4`:
909909

910+
.. attribute:: IMAP4.capabilities
911+
912+
A tuple of the capabilities advertised by the server, in upper case.
913+
914+
It is set when the connection is established,
915+
and refreshed after a successful :meth:`~IMAP4.login`,
916+
:meth:`~IMAP4.authenticate` or :meth:`~IMAP4.starttls`,
917+
because the server can advertise different capabilities
918+
in different connection states.
919+
920+
.. versionchanged:: 3.14.7
921+
Refreshed after :meth:`~IMAP4.login` and :meth:`~IMAP4.authenticate`.
922+
923+
910924
.. attribute:: IMAP4.PROTOCOL_VERSION
911925

912926
The most recent supported protocol in the ``CAPABILITY`` response from the

Doc/library/mimetypes.rst

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ than one MIME-type database; it provides an interface similar to the one of the
211211
.. class:: MimeTypes(filenames=(), strict=True)
212212

213213
This class represents a MIME-types database. By default, it provides access to
214-
the same database as the rest of this module. The initial database is a copy of
215-
that provided by the module, and may be extended by loading additional
214+
the same database as the rest of this module. The initial database is created from
215+
Python's built-in MIME type tables. It may be extended by loading additional
216216
:file:`mime.types`\ -style files into the database using the :meth:`read` or
217217
:meth:`readfp` methods. The mapping dictionaries may also be cleared before
218218
loading additional data if the default data is not desired.
@@ -226,30 +226,32 @@ than one MIME-type database; it provides an interface similar to the one of the
226226
Dictionary mapping suffixes to suffixes. This is used to allow recognition of
227227
encoded files for which the encoding and the type are indicated by the same
228228
extension. For example, the :file:`.tgz` extension is mapped to :file:`.tar.gz`
229-
to allow the encoding and type to be recognized separately. This is initially a
230-
copy of the global :data:`suffix_map` defined in the module.
229+
to allow the encoding and type to be recognized separately.
230+
This is initialized with some predefined values.
231231

232232

233233
.. attribute:: MimeTypes.encodings_map
234234

235-
Dictionary mapping filename extensions to encoding types. This is initially a
236-
copy of the global :data:`encodings_map` defined in the module.
235+
Dictionary mapping filename extensions to encoding types.
236+
This is initialized with some predefined values.
237237

238238

239239
.. attribute:: MimeTypes.types_map
240240

241241
Tuple containing two dictionaries, mapping filename extensions to MIME types:
242242
the first dictionary is for the non-standards types and the second one is for
243-
the standard types. They are initialized by :data:`common_types` and
244-
:data:`types_map`.
243+
the standard types.
244+
They are initialized with some predefined values and MIME type
245+
information loaded from files specified by the *filenames* argument.
245246

246247

247248
.. attribute:: MimeTypes.types_map_inv
248249

249250
Tuple containing two dictionaries, mapping MIME types to a list of filename
250251
extensions: the first dictionary is for the non-standards types and the
251-
second one is for the standard types. They are initialized by
252-
:data:`common_types` and :data:`types_map`.
252+
second one is for the standard types.
253+
They are initialized with some predefined values and MIME type
254+
information loaded from files specified by the *filenames* argument.
253255

254256

255257
.. method:: MimeTypes.guess_extension(type, strict=True)

Doc/library/test.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,10 @@ The :mod:`!test.support` module defines the following constants:
232232

233233
.. data:: verbose
234234

235-
``True`` when verbose output is enabled. Should be checked when more
236-
detailed information is desired about a running test. *verbose* is set by
237-
:mod:`test.regrtest`.
235+
How verbose the output is: the number of :option:`!-v` options which
236+
:mod:`test.regrtest` was run with, and therefore ``0`` when verbose output
237+
is not enabled. Should be checked when more detailed information is
238+
desired about a running test.
238239

239240

240241
.. data:: is_jython

Doc/library/turtle.rst

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
**Source code:** :source:`Lib/turtle.py`
99

1010
.. testsetup:: default
11+
:skipif: _tkinter is None
1112

1213
from turtle import *
1314
turtle = Turtle()
1415

1516
.. testcleanup::
17+
:skipif: _tkinter is None
1618

1719
import os
1820
os.remove("my_drawing.ps")
@@ -510,6 +512,7 @@ Turtle motion
510512
turtle is headed. Do not change the turtle's heading.
511513

512514
.. doctest::
515+
:skipif: _tkinter is None
513516
:hide:
514517

515518
>>> turtle.goto(0, 0)
@@ -852,6 +855,7 @@ Turtle motion
852855
last *n* stamps.
853856

854857
.. doctest::
858+
:skipif: _tkinter is None
855859

856860
>>> for i in range(8):
857861
... unused_stamp_id = turtle.stamp()
@@ -1409,8 +1413,11 @@ More drawing control
14091413
font. If *move* is true, the pen is moved to the bottom-right corner of the
14101414
text. By default, *move* is ``False``.
14111415

1412-
>>> turtle.write("Home = ", True, align="center")
1413-
>>> turtle.write((0,0), True)
1416+
.. doctest::
1417+
:skipif: _tkinter is None
1418+
1419+
>>> turtle.write("Home = ", True, align="center")
1420+
>>> turtle.write((0,0), True)
14141421

14151422

14161423
Turtle state
@@ -1447,12 +1454,15 @@ Visibility
14471454

14481455
Return ``True`` if the Turtle is shown, ``False`` if it's hidden.
14491456

1450-
>>> turtle.hideturtle()
1451-
>>> turtle.isvisible()
1452-
False
1453-
>>> turtle.showturtle()
1454-
>>> turtle.isvisible()
1455-
True
1457+
.. doctest::
1458+
:skipif: _tkinter is None
1459+
1460+
>>> turtle.hideturtle()
1461+
>>> turtle.isvisible()
1462+
False
1463+
>>> turtle.showturtle()
1464+
>>> turtle.isvisible()
1465+
True
14561466

14571467

14581468
Appearance
@@ -1983,6 +1993,9 @@ Window control
19831993
method, one can make visible those parts of a drawing which were outside the
19841994
canvas before.
19851995

1996+
.. doctest::
1997+
:skipif: _tkinter is None
1998+
19861999
>>> screen.screensize()
19872000
(400, 300)
19882001
>>> screen.screensize(2000,1500)

Doc/library/unittest.rst

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ You can run tests with more detail (higher verbosity) by passing in the -v flag:
180180

181181
python -m unittest -v test_module
182182

183+
Repeat it for even more detail: ``-vv`` reports also the individual examples
184+
of a :mod:`doctest`.
185+
183186
When executed without arguments :ref:`unittest-test-discovery` is started::
184187

185188
python -m unittest
@@ -291,7 +294,11 @@ The ``discover`` sub-command has the following options:
291294

292295
.. option:: -v, --verbose
293296

294-
Verbose output
297+
Verbose output. May be repeated: ``-vv`` reports also the individual
298+
examples of a :mod:`doctest`.
299+
300+
.. versionchanged:: next
301+
The option can be repeated.
295302

296303
.. option:: -s, --start-directory directory
297304

@@ -2149,6 +2156,15 @@ Loading and running tests
21492156

21502157
.. versionadded:: 3.5
21512158

2159+
.. attribute:: verbosity
2160+
2161+
The level of details which the test runner reports: ``0`` -- quiet,
2162+
``1`` -- progress dots, ``2`` -- test names, ``3`` -- also the
2163+
individual examples of a :mod:`doctest`. A test runner is expected to
2164+
set it to its own verbosity.
2165+
2166+
.. versionadded:: next
2167+
21522168
.. method:: wasSuccessful()
21532169

21542170
Return ``True`` if all tests run so far have passed, otherwise returns

Doc/library/venv.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,12 @@ creation according to their needs, the :class:`EnvBuilder` class.
452452
On POSIX systems, if a specific executable ``python3.x`` was used,
453453
symlinks to ``python`` and ``python3`` will be created pointing to that
454454
executable, unless files with those names already exist.
455+
On POSIX systems, a broken symlink at a destination path is removed
456+
before the copy or symlink is created.
457+
458+
.. versionchanged:: next
459+
A broken symlink at a destination path is now removed and replaced.
460+
Previously it was left in place, or it made the copy fail.
455461

456462
.. method:: setup_scripts(context)
457463

0 commit comments

Comments
 (0)