Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pylint and unittest

Tags:

pylint

I have a python project that is using pylint and unittest. Unittest has me using methods called setUp() which pylint doesn't like. Specifically:

C0103: 57,4:<class>.setUp: Invalid name "setUp" for type method (should match [a-z_][a-z0-9_]{2,30}$)

How can I get pylint to allow setUp as a method name? I don't see a configuration item called "allowed method names" for example. I'd rather not use # pylint: disable=C0103 all over as there are a lot of setUp methods in my code.

like image 865
Erik Avatar asked Nov 05 '12 15:11

Erik


1 Answers

change the method-rgx setting in your configuration file (it's in the BASIC section). Something like this should do the trick:

method-rgx=(([a-z_][a-z0-9_]{2,30})|(setUp)|(tearDown))$
like image 159
gurney alex Avatar answered Oct 22 '22 16:10

gurney alex