Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exclude test files from Pylint

I have my unit tests living alongside my source code. i.e.

├── __init__.py
├── formatter.py
└── test_formatter.py

Is there a way to get Pylint to exclude all files prefixed with test_ from its analysis? The ignore configuration option doesn't seem to like wildcards.

like image 518
Mr. S Avatar asked Nov 25 '15 18:11

Mr. S


People also ask

How do I get Pylint to ignore a file?

The solution was to include --disable=file-ignored in the Pylint command options.


2 Answers

This was introduced as a feature in Pylint 1.6 via the --ignore-patterns option.

So, to ignore the files above:

pylint myproject --ignore-patterns=test_.*?py
like image 194
Mr. S Avatar answered Oct 13 '22 21:10

Mr. S


there is indeed no wildcard support. You may submit a feature request or even better a pull-request on https://github.com/PyCQA/pylint

like image 42
sthenault Avatar answered Oct 13 '22 21:10

sthenault