[issue22293] unittest.mock: use slots in MagicMock to reduce memory footprint

Michael Foord report at bugs.python.org
Fri Aug 29 14:41:25 CEST 2014


Michael Foord added the comment:

Switching to Mock instead of MagicMock may help, as that doesn't have the magic proxies at all. (patch has an argument to specify which class of Mock should be used to create the mock object, MagicMock is just the default.)

Other wise using __slots__ would be fine. An alternative approach would be for MagicMock to use __getattribute__ instead of the magic proxies.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22293>
_______________________________________


More information about the Python-bugs-list mailing list