Add pyflakes

Add ability to use pyflakes to tox.ini

Change-Id: If334cb1ac64a5fe7aabb17af0048a20aa2cdd921
Signed-off-by: Chuck Short <chuck.short@canonical.com>
This commit is contained in:
Chuck Short 2013-01-07 15:10:06 -06:00
parent b5e3d5d4cb
commit 6f9c6ea000
2 changed files with 26 additions and 0 deletions

22
tools/flakes.py Normal file
View File

@ -0,0 +1,22 @@
"""
wrapper for pyflakes to ignore gettext based warning:
"undefined name '_'"
From https://bugs.launchpad.net/pyflakes/+bug/844592
"""
import __builtin__
import os
import sys
from pyflakes.scripts.pyflakes import main
if __name__ == "__main__":
names = os.environ.get('PYFLAKES_BUILTINS', '_')
names = [x.strip() for x in names.split(',')]
for x in names:
if not hasattr(__builtin__, x):
setattr(__builtin__, x, True)
del names, os, __builtin__
sys.exit(main())

View File

@ -36,3 +36,7 @@ deps = -r{toxinidir}/tools/test-requires-folsom
[testenv:py27-folsom]
deps = -r{toxinidir}/tools/test-requires-folsom
-r{toxinidir}/tools/pip-requires
[testenv:pyflakes]
deps = pyflakes
commands = python tools/flakes.py ceilometer