I'd like to invoke the pylint checker, limited to the Error signalling part, as part of my unit testing. so I checked the pylint executable script, got to the pylint.lint.Run
helper class and there I got lost in a quite long __init__
function, ending with a call to sys.exit()
.
anybody ever tried and managed to do so?
the dream-plan would be this:
if __name__ == '__main__':
import pylint.lint
pylint.lint.something(__file__, justerrors=True)
# now continue with unit testing
any hints? other than "copy the __init__
method and skip the sys.exit()
", I mean?
I don't need the tests to be run by pylint
, it might as well be pyflakes
or other software: feel free to suggest alternatives. thanks!
Take a look at the pylint/epylint.py
which contains two different ways to start pylint programatically.
You can also simply call :
from pylint.lint import Run
Run(['--errors-only', 'myfile.py'])
for instance.