Skip to content

Conversation

@cjw296
Copy link
Collaborator

@cjw296 cjw296 commented Mar 1, 2025

This is preparing a release to mark @voidspace's funeral.

In memoriam: Michael Foord 1974-2025

cjw296 and others added 9 commits March 1, 2025 10:39
…(#106822)

threadingmock: Improve test suite to avoid race conditions

Simplify tests and split them into multiple tests to prevent assertions
from triggering race conditions.
Additionally, we rely on calling the mocks without delay to validate the
functionality of matching calls.

Backports: 7e96370a946a2ca0f2f25af4ce5b3b59f020721b
Signed-off-by: Chris Withers <chris@withers.org>
…ror to RuntimeError (#108847)

Backports: 0c369d6cb8c9a73725f5794c84bedf93e46fd27d
Signed-off-by: Chris Withers <chris@withers.org>
Backports: 19601efa364fe3c294d8010effe11e025cbc230e
Signed-off-by: Chris Withers <chris@withers.org>
Align expected and actual titles in output from
assert_has_calls/assert_called_with for greater readability

Backports: 77dbd956090aac66e264d9d640f6adb6b0930b87
Signed-off-by: Chris Withers <chris@withers.org>
…docstrings (GH-113408)

Backports: 0c574540e07792cef5487aef61ab38bfe404060f
Signed-off-by: Chris Withers <chris@withers.org>
…(GH-113573)

Backports: 1600d78e2d090319930c6538b496ffcca120a696
Signed-off-by: Chris Withers <chris@withers.org>
@cjw296 cjw296 force-pushed the backport-january-2025 branch from 4aa1aec to 0bc7b86 Compare March 1, 2025 18:03
cjw296 and others added 5 commits March 1, 2025 18:11
Backports: f8e9c57067e32baab4ed2fd824b892c52ecb7225
Signed-off-by: Chris Withers <chris@withers.org>
* set default return value of functional types as _mock_return_value

* added test of wrapping child attributes

* added backward compatibility with explicit return

* added docs on the order of precedence

* added test to check default return_value

Backports: 735fc2cbbcf875c359021b5b2af7f4c29f4cf66d
Signed-off-by: Chris Withers <chris@withers.org>
…-118176)

Add tests for "import", pkgutil.resolve_name() and unittest.mock.path()
for cases when "import a.b as x" and "from a import b as x" give
different results.

Backports: c0eaa232f63a62e0e0408911ab5f118dca2af607
Signed-off-by: Chris Withers <chris@withers.org>
…ames (GH-118176)"

This reverts commit ac760fa.

These test-only changes rely on a CPython source checkout
@cjw296 cjw296 force-pushed the backport-january-2025 branch from 0bc7b86 to e5fd961 Compare March 1, 2025 18:11
infohash and others added 6 commits March 1, 2025 18:11
…(#118163)

Backports: b28a3339e4c63ea3a801dba9bbbc6af5af42c3a0
Signed-off-by: Chris Withers <chris@withers.org>
As reported in #117847 and #115366, an unpaired backtick in a docstring
tends to confuse e.g. Sphinx running on subclasses of standard library
objects, and the typographic style of using a backtick as an opening
quote is no longer in favor. Convert almost all uses of the form

    The variable `foo' should do xyz

to

    The variable 'foo' should do xyz

and also fix up miscellaneous other unpaired backticks (extraneous /
missing characters).

No functional change is intended here other than in human-readable
docstrings.

Backports: ef172521a9e9dfadebe57d590bfb53a0e9ac3a0b
Signed-off-by: Chris Withers <chris@withers.org>
…le is set (#119601)

In order to patch flask.g e.g. as in #84982, that
proxies getattr must not be invoked. For that,
mock must not try to read from the original
object. In some cases that is unavoidable, e.g.
when doing autospec. However, patch("flask.g",
new_callable=MagicMock) should be entirely safe.

Backports: 422c4fc855afd18bcc6415902ea1d85a50cb7ce1
Signed-off-by: Chris Withers <chris@withers.org>
…__setattr__ (#120019)

Backports: 9e9ee50421c857b443e2060274f17fb884d54473
Signed-off-by: Chris Withers <chris@withers.org>
…_autospec` (#120737)

Backports: 1e4815692f6c8a37a3974d0d7d2025494d026d76
Signed-off-by: Chris Withers <chris@withers.org>
Backports: 8303d32ff55945c5b38eeeaf1b1811dbcf8aa9be
Signed-off-by: Chris Withers <chris@withers.org>
@cjw296 cjw296 force-pushed the backport-january-2025 branch from f72ab0d to 0243cb6 Compare March 1, 2025 18:43
cjw296 and others added 7 commits March 3, 2025 10:01
Deprecate `asyncio.iscoroutinefunction` in favor of `inspect.iscoroutinefunction`.

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Backports: bc9d92c67933917b474e61905451c6408c68e71d
Signed-off-by: Chris Withers <chris@withers.org>
Selecting the source by version here appears to keep the tests passing on more versions
Backports: 1de46136b916736487019c2f78af2bf0cadd7ecd
Signed-off-by: Chris Withers <chris@withers.org>
…124038)

Backports: 7628f67d55cb65bad9c9266e0457e468cd7e3775
Signed-off-by: Chris Withers <chris@withers.org>
sobolevn and others added 6 commits March 3, 2025 10:23
Backports: 19fed6cf6eb51044fd0c02c6338259e2dd7fd462
Signed-off-by: Chris Withers <chris@withers.org>
…#124429)

Backports: 3a0e7f57628466aedcaaf6c5ff7c8224f5155a2c
Signed-off-by: Chris Withers <chris@withers.org>
…t (#126649)

Previously, this would cause an `AttributeError` if the patch stopped more than once after this, and would also disrupt the original patched object.

---------

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Backports: 1e40c5ba47780ddd91868abb3aa064f5ba3015e4
Signed-off-by: Chris Withers <chris@withers.org>
First step towards deprecating the asyncio policy system.
This deprecates `asyncio.set_event_loop_policy` and will be removed in Python 3.16.

Backports: 5892853fb71acd6530e1e241a9a4bcf71a61fb21
Signed-off-by: Chris Withers <chris@withers.org>
Add the following methods:

* assertHasAttr() and assertNotHasAttr()
* assertIsSubclass() and assertNotIsSubclass()
* assertStartsWith() and assertNotStartsWith()
* assertEndsWith() and assertNotEndsWith()

Also improve error messages for assertIsInstance() and
assertNotIsInstance().

Backports: 06cad77a5b345adde88609be9c3c470c5cd9f417
Signed-off-by: Chris Withers <chris@withers.org>
…28707)"

This reverts commit 7cf5bc4.

Older python versions don't have these new assert methods
@cjw296 cjw296 force-pushed the backport-january-2025 branch 3 times, most recently from 75e792b to 072a7f2 Compare March 3, 2025 11:05
@cjw296 cjw296 force-pushed the backport-january-2025 branch from 072a7f2 to 23cb115 Compare March 3, 2025 11:28
cjw296 added 5 commits March 3, 2025 12:12
Since it's been deprecated in newer Python versions
* Mark functions that will never be called with # pragma: no cover

* Fix testpatch.PatchTest.test_exit_idempotent

.stop() and __exit__ have subtly different code paths, so to really test __exit__ idempotency, we need to call it specifically twice.

Backports: 04091c083340dde7d4eeb6d945c70f3b37d88f85
Signed-off-by: Chris Withers <chris@withers.org>
@cjw296 cjw296 force-pushed the backport-january-2025 branch from 23cb115 to 3a9e809 Compare March 3, 2025 12:12
@cjw296 cjw296 merged commit 563f311 into testing-cabal:master Mar 3, 2025
13 checks passed
@cjw296 cjw296 deleted the backport-january-2025 branch March 3, 2025 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.