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.

classification
Title: Everything in Mock should inherit from Base
Type: Stage: resolved
Components: Versions: Python 3.9, Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: lisroach Nosy List: ezio.melotti, lisroach, michael.foord, xtreak
Priority: normal Keywords: patch

Created on 2019-09-11 13:24 by lisroach, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 16060 merged lisroach, 2019-09-12 14:48
PR 16470 merged miss-islington, 2019-09-29 01:44
Messages (4)
msg351863 - (view) Author: Lisa Roach (lisroach) * (Python committer) Date: 2019-09-11 13:24
Everything within Mock should be inheriting from the top-level parent class, Base (and properly call super).

For multiple inheritance to work correctly they all should be inheriting from the same parent class ultimately. 

Classes that need update:

MagicMixin
AsyncMagicMixin
NonCallableMock (instance = object.__new__(new) should be switched to a super call here)
msg351886 - (view) Author: Lisa Roach (lisroach) * (Python committer) Date: 2019-09-11 14:00
Also:

_AsyncIterator
_AwaitEvent

Some of the code in AsyncMagicMixin might be able to be simplified if we inherit from MagicMixin instead, right now we might be duplicating work.

In general we have to watch out for duplication/overwriting of attributes with this change.
msg353478 - (view) Author: Lisa Roach (lisroach) * (Python committer) Date: 2019-09-29 01:42
New changeset 9a7d9519506ae807ca48ff02e2ea117ebac3450e by Lisa Roach in branch 'master':
bpo-38108: Makes mock objects inherit from Base (GH-16060)
https://github.com/python/cpython/commit/9a7d9519506ae807ca48ff02e2ea117ebac3450e
msg353530 - (view) Author: Lisa Roach (lisroach) * (Python committer) Date: 2019-09-30 04:02
New changeset b76ab352405df105c2d459fc66ef8dc98e47b37c by Lisa Roach (Miss Islington (bot)) in branch '3.8':
bpo-38108: Makes mock objects inherit from Base (GH-16060) (GH-16470)
https://github.com/python/cpython/commit/b76ab352405df105c2d459fc66ef8dc98e47b37c
History
Date User Action Args
2022-04-11 14:59:20adminsetgithub: 82289
2019-09-30 04:21:10lisroachsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-09-30 04:02:49lisroachsetmessages: + msg353530
2019-09-29 01:44:17miss-islingtonsetpull_requests: + pull_request16053
2019-09-29 01:42:49lisroachsetmessages: + msg353478
2019-09-12 14:48:33lisroachsetkeywords: + patch
stage: patch review
pull_requests: + pull_request15683
2019-09-11 14:00:00lisroachsetmessages: + msg351886
2019-09-11 13:24:30lisroachcreate