-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
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 |
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.
Is there any reason here to be using functools.partial
over lambda
?
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.
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 ✅ . |
Since python/cpython#18544, unittest mock is not able to properly find the "odoo.tools.config". When trying to patch the `options` dictionnary, it leads to `AttributeError: module 'odoo.tools.config' has no attribute 'options'` In order to have the tests working in python <= 3.11, we have to import the config module and patch the options in place.
Since python/cpython#18544, unittest mock is not able to properly find the "odoo.tools.config". When trying to patch the `options` dictionnary, it leads to `AttributeError: module 'odoo.tools.config' has no attribute 'options'` In order to have the tests working in python <= 3.11, we have to import the config module and patch the options in place. Part-of: #112317
Since python/cpython#18544, unittest mock is not able to properly find the "odoo.tools.config". When trying to patch the `options` dictionnary, it leads to `AttributeError: module 'odoo.tools.config' has no attribute 'options'` In order to have the tests working in python <= 3.11, we have to import the config module and patch the options in place. X-original-commit: 482cb08
Since python/cpython#18544, unittest mock is not able to properly find the "odoo.tools.config". When trying to patch the `options` dictionnary, it leads to `AttributeError: module 'odoo.tools.config' has no attribute 'options'` In order to have the tests working in python <= 3.11, we have to import the config module and patch the options in place.
Since python/cpython#18544, unittest mock is not able to properly find the "odoo.tools.config". When trying to patch the `options` dictionnary, it leads to `AttributeError: module 'odoo.tools.config' has no attribute 'options'` In order to have the tests working in python <= 3.11, we have to import the config module and patch the options in place. X-original-commit: 482cb08 Part-of: #112440
Since python/cpython#18544, unittest mock is not able to properly find the "odoo.tools.config". When trying to patch the `options` dictionnary, it leads to `AttributeError: module 'odoo.tools.config' has no attribute 'options'` In order to have the tests working in python <= 3.11, we have to import the config module and patch the options in place. Part-of: #112450
Since python/cpython#18544, unittest mock is not able to properly find the "odoo.tools.config". When trying to patch the `options` dictionnary, it leads to `AttributeError: module 'odoo.tools.config' has no attribute 'options'` In order to have the tests working in python <= 3.11, we have to import the config module and patch the options in place. Part-of: odoo#112317
Since python/cpython#18544, unittest mock is not able to properly find the "odoo.tools.config". When trying to patch the `options` dictionnary, it leads to `AttributeError: module 'odoo.tools.config' has no attribute 'options'` In order to have the tests working in python <= 3.11, we have to import the config module and patch the options in place.
Since python/cpython#18544, unittest mock is not able to properly find the "odoo.tools.config". When trying to patch the `options` dictionnary, it leads to `AttributeError: module 'odoo.tools.config' has no attribute 'options'` In order to have the tests working in python <= 3.11, we have to import the config module and patch the options in place.
Since python/cpython#18544, unittest mock is not able to properly find the "odoo.tools.config". When trying to patch the `options` dictionnary, it leads to `AttributeError: module 'odoo.tools.config' has no attribute 'options'` In order to have the tests working in python <= 3.11, we have to import the config module and patch the options in place. Part-of: #151989
https://bugs.python.org/issue44686
Automerge-Triggered-By: GH:cjw296