Flake8 / pylint does not work in Tox testing environment, throws InvocationError

I learned how to do core testing for my python project.

I have (what should be) a pretty standard token initialization file that looks like this:

[tox] envlist=py27,flake8 ... [testenv:flake8] deps=flake8 commands=flake8 library # 'library' is temp. name of project 

Everything looks fine, all tests work, and even quitting flake8 passes (output below). However, the current raises an InvocationError (it does the same for testing with pylint)

 flake8 recreate: /Users/shostakovich/projects/project_templates/library/.tox/flake8 flake8 installdeps: flake8 flake8 inst: /Users/shostakovich/projects/project_templates/library/.tox/dist/library-0.1.0.zip flake8 installed: flake8==2.4.1,library==0.1.0,mccabe==0.3,pep8==1.5.7,pyflakes==0.8.1,wheel==0.24.0 library/__main__.py:12:1: F401 'os' imported but unused library/__main__.py:13:1: F401 're' imported but unused ... ERROR: InvocationError: '/Users/shostakovich/projects/project_templates/library/.tox/flake8/bin/flake8 library' 

I am running current 2.0.2 on MaxOSX 10.9.5. The problem will disappear if I just call flake8 or pylint (the flake8 version is shown above).

+7
python testing tox flake8
source share
1 answer

tox does not work, it works!

There are findings in your flake8 source code flake8 , and therefore tox with the error that your test result. Correct the results and your results!

You can configure the flake8 run to ignore specific codes using the section in tox.ini . From flake8 docs :

 [flake8] ignore = E226,E302,E41 

There are more options that may interest you, for example. select = ... to test code with white support enabled.

+12
source share

All Articles