Hello pylint folks,
I have an issue with decorated methods which argument passing is handled by the
decorator. I am using the mock.patch
(http://www.voidspace.org.uk/python/mock/patch.html) decorator to well ... mock
objects. Anyway, pylint keeps complaining about the method not being called
with the right argument numbers.
I can see why it bothers pylint, but I cannot find any workaround apart from
disabling the error. I have the feeling there's no better solution since pylint
has no idea about what mock.patch does. Any clue ?
To extend my question I had to work quite a lot for my unit tests py files to
be properly processed by pylint. Since these unit test files are all about
trickery, replacing legit objects by fake ones, I'm starting to wonder if
excluding all my py_unit files from the pylint process wouldn't be the best
way to go.
Regards,
JM
------------------------
import mock
import telnetlib
class Bar:
@mock.patch('telnetlib.Telnet')
def foo(self, mockTelnet):
print telnetlib.Telnet
print mockTelnet
Bar().foo() # mockTelnet parameter is handled by the decorator
************* Module test
E1120: 10,0: No value passed for parameter 'mockTelnet' in function call
[1] 30729 exit 2 pylint test.py
-- IMPORTANT NOTICE:
The contents of this email and any attachments are confidential and may also be
privileged. If you are not the intended recipient, please notify the sender
immediately and do not disclose the contents to any other person, use it for
any purpose, or store or copy the information in any medium. Thank you.
_______________________________________________
Python-Projects mailing list
[email protected]
http://lists.logilab.org/mailman/listinfo/python-projects