bpo-44686 replace unittest.mock._importer with pkgutil.resolve_name #18544
Conversation
Codecov Report
@@ Coverage Diff @@
## master #18544 +/- ##
==========================================
- Coverage 83.25% 83.20% -0.06%
==========================================
Files 1571 1571
Lines 414749 414735 -14
Branches 44456 44453 -3
==========================================
- Hits 345300 345068 -232
- Misses 59795 60019 +224
+ Partials 9654 9648 -6
Continue to review full report at Codecov.
|
|
I think this deserves a discussion and a bpo. @cjw296 this uses |
| @@ -1583,8 +1565,7 @@ def _get_target(target): | |||
| except (TypeError, ValueError): | |||
| raise TypeError("Need a valid target to patch. You supplied: %r" % | |||
| (target,)) | |||
| getter = lambda: _importer(target) | |||
| return getter, attribute | |||
| return partial(pkgutil.resolve_name, target), attribute | |||
FFY00
May 20, 2020
Member
Is there any reason here to be using functools.partial over lambda?
Is there any reason here to be using functools.partial over lambda?
graingert
Jul 20, 2021
Author
Contributor
for consistency. lambda: is used twice in this file whereas partial( is used six times
for consistency. lambda: is used twice in this file whereas partial( is used six times
|
@tirkarthi: Looking at the diff, we could probably just skip backporting this one... |
I've now created the bpo |
Misc/NEWS.d/next/Library/2021-07-20-19-35-49.bpo-44686.ucCGhu.rst
Outdated
Show resolved
Hide resolved
|
@graingert: Status check is done, and it's a success |
|
@graingert: Status check is done, and it's a success |
|
Sorry, I can't merge this PR. Reason: |
|
@graingert: Status check is done, and it's a success |
ab7fcc8
into
python:main
https://bugs.python.org/issue44686
Automerge-Triggered-By: GH:cjw296