InvocationError while running flake8 in tox.ini

Viewed 1094

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?

2 Answers

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

I will double check the exact error message when I am at a PC, but you totally expect tox to fail when one of the commands in one environment is failing.

If you just want to check the output, but the command should succeed even when there are problems, you need to prepend the command with a dash -.

Related