Search code examples
python-3.xtoxflake8

InvocationError while running flake8 in tox.ini



It looks like I can't pass the relative nor absolute path to the folder that should be checked by flake8 inside the tox.ini file.

After performing a code in the shell:

flake8 tests/

Result is correct:

tests/unit\test.py:17:91: E501 line too long (93 > 90 characters)

But the same command started by tox by typing into the command prompt:

tox

results with:

py38 installed: flake8==3.9.2,mccabe==0.6.1,pycodestyle==2.7.0,pyflakes==2.3.1
py38 run-test-pre: PYTHONHASHSEED='64'
py38 run-test: commands[0] | flake8 tests/
tests/unit\test.py:17:91: E501 line too long (93 > 90 characters)
ERROR: InvocationError for command 'C:\Users\48796\PycharmProjects\learningTests\.tox\py38\Scripts\flake8.EXE' tests/ (exited with code 1)
_______________________________________________________ summary _______________________________________________________
ERROR:   py38: commands failed

So the command is executed properly and then runs into an error. As you can see in the third row - the command is identical.

Any ideas?


Solution

  • because flake8 detected errors in your code it exits nonzero

    when tox detects a command exiting nonzero it presents an InvocationError

    everything is working as intended :)


    disclaimer: I'm the current flake8 maintainer and a tox core dev