-
Notifications
You must be signed in to change notification settings - Fork 105
January '25 backporting #513
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…(#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>
4aa1aec to
0bc7b86
Compare
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
0bc7b86 to
e5fd961
Compare
…(#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>
f72ab0d to
0243cb6
Compare
...rather than by python version
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
… to handle iscoroutinefunction differently
Backports: 1de46136b916736487019c2f78af2bf0cadd7ecd Signed-off-by: Chris Withers <chris@withers.org>
…124038) Backports: 7628f67d55cb65bad9c9266e0457e468cd7e3775 Signed-off-by: Chris Withers <chris@withers.org>
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
75e792b to
072a7f2
Compare
072a7f2 to
23cb115
Compare
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>
23cb115 to
3a9e809
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is preparing a release to mark @voidspace's funeral.
In memoriam: Michael Foord 1974-2025