- Python Home
- About
- News
- Documentation
- Downloads
- Community
- Foundation
- Developer's Guide
- Issue Tracker
- Issues
- Summaries
- User
- Administration
- Help
➜
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
| Author | xtreak |
|---|---|
| Recipients | Adnan Umer, cjw296, mariocj89, remi.lapeyre, xtreak |
| Date | 2019-02-14.18:04:09 |
| SpamBayes Score | -1.0 |
| Marked as misclassified | Yes |
| Message-id | <1550167449.72.0.301070443858.issue35577@roundup.psfhosted.org> |
| In-reply-to |
| Content |
|---|
Thanks for the report. I think this is design by choice that self is not passed to the side_effect directly set on the mock [0]. Changing this would break existing tests like [1] . You can use the approach by @remi.lapeyre which directly replaces the function on the target inside the context manager at [2] passing self to the side_effect callable. [0] https://github.com/python/cpython/blob/8a1657b93469580ef345c7c91738587f3d76e87d/Lib/unittest/mock.py#L1043 [1] https://github.com/python/cpython/blob/8a1657b93469580ef345c7c91738587f3d76e87d/Lib/unittest/test/testmock/testmock.py#L664 [2] https://github.com/python/cpython/blob/8a1657b93469580ef345c7c91738587f3d76e87d/Lib/unittest/mock.py#L1376 |
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2019-02-14 18:04:09 | xtreak | set | recipients: + xtreak, cjw296, mariocj89, remi.lapeyre, Adnan Umer |
| 2019-02-14 18:04:09 | xtreak | set | messageid: <1550167449.72.0.301070443858.issue35577@roundup.psfhosted.org> |
| 2019-02-14 18:04:09 | xtreak | link | issue35577 messages |
| 2019-02-14 18:04:09 | xtreak | create |
Powered by Roundup Copyright © 1990-2022, Python Software Foundation
Legal Statements
