with mock.patch.object(builtins, 'print', autospec=True):
print('hai')
In 3.4:
$ python test.py
Traceback (most recent call last):
File "test.py", line 4, in
with mock.patch.object(builtins, 'print', autospec=True):
File "/tmp/venv34/lib/python3.4/site-packages/mock.py", line 1349, in enter
_name=self.attribute, kwargs)
File "/tmp/venv34/lib/python3.4/site-packages/mock.py", line 2193, in create_autospec
_check_signature(spec, mock, is_type, instance)
File "/tmp/venv34/lib/python3.4/site-packages/mock.py", line 213, in _check_signature
_copy_func_details(func, checksig)
File "/tmp/venv34/lib/python3.4/site-packages/mock.py", line 221, in _copy_func_details
funcopy.module = func.module
AttributeError: 'method-wrapper' object has no attribute 'module**'
Original issue reported on code.google.com by asott...@yelp.com on 7 Jul 2014 at 11:23
import builtins import mock
with mock.patch.object(builtins, 'print', autospec=True): print('hai')
$ python test.py Traceback (most recent call last): File "test.py", line 4, in
with mock.patch.object(builtins, 'print', autospec=True):
File "/tmp/venv34/lib/python3.4/site-packages/mock.py", line 1349, in enter
_name=self.attribute, kwargs)
File "/tmp/venv34/lib/python3.4/site-packages/mock.py", line 2193, in create_autospec
_check_signature(spec, mock, is_type, instance)
File "/tmp/venv34/lib/python3.4/site-packages/mock.py", line 213, in _check_signature
_copy_func_details(func, checksig)
File "/tmp/venv34/lib/python3.4/site-packages/mock.py", line 221, in _copy_func_details
funcopy.module = func.module
AttributeError: 'method-wrapper' object has no attribute 'module**'
Original issue reported on code.google.com by
asott...@yelp.com
on 7 Jul 2014 at 11:23