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 berdario
Recipients berdario
Date 2015-01-24.17:20:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I guess this should be expected... too much magic :P

>>> from unittest.mock import MagicMock
>>> MagicMock(**{'__hash__.return_value': "FIXME"})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/nix/store/qlvbf3n3y34idxcgwwhsi9pq26v28q99-python3-3.4.2/lib/python3.4/unittest/", line 1772, in __init__
    _safe_super(MagicMixin, self).__init__(*args, **kw)
  File "/nix/store/qlvbf3n3y34idxcgwwhsi9pq26v28q99-python3-3.4.2/lib/python3.4/unittest/", line 881, in __init__
    _spec_state, _new_name, _new_parent, **kwargs
  File "/nix/store/qlvbf3n3y34idxcgwwhsi9pq26v28q99-python3-3.4.2/lib/python3.4/unittest/", line 410, in __init__
  File "/nix/store/qlvbf3n3y34idxcgwwhsi9pq26v28q99-python3-3.4.2/lib/python3.4/unittest/", line 560, in configure_mock
    setattr(obj, final, val)
AttributeError: 'method-wrapper' object has no attribute 'return_value'

The same happens with e.g. __str__

>>> m.configure_mock(**{'__hash__.return_value': 1})

works just fine, instead
Date User Action Args
2015-01-24 17:20:39berdariosetrecipients: + berdario
2015-01-24 17:20:39berdariosetmessageid: <>
2015-01-24 17:20:39berdariolinkissue23310 messages
2015-01-24 17:20:39berdariocreate