[openstack-dev] [tox/pep8] different result between running tox and pep8

Jeremy Stanley fungi at yuggoth.org
Fri Jul 10 11:30:36 UTC 2015

On 2015-07-10 03:15:08 +0000 (+0000), Gareth wrote:
> My problem looks simple:
> Running "tox -e pep8", the result says ok, not pep8 mistakes.
> Running "pep8 .", a lot of pep8 mistkes come out.
> But in your project's tox.ini, there isn't such a long ignore list. So what
> makes this difference happen?

It depends a lot on what repository you're running pep8 against, but
there are a couple of fundamental differences between running pep8
directly and invoking a pep8 environment through tox:

1. In most cases tox is not set to use system site packages, and so
will potentially install a different version of pep8 into the
virtualenv it creates than you have installed system-wide.

2. Most of our repos have the "pep8" environment in their tox.ini
configured to invoke flake8 instead, which also runs the pyflakes
checker and possibly other plugins like the hacking checker.
Further, flake8 reads an exclusion list from tox.ini and so may not
report some PEP-8 compliance violations that you'll see when running
the pep8 tool directly.

So, I hope that explains the difference. When you run `tox -e pep8`
you're not asking tox to invoke the pep8 tool; rather you're asking
tox to invoke a set of commands associated with an environment
definition named "pep8" in its tox.ini file.
Jeremy Stanley

More information about the OpenStack-dev mailing list