Add pyflakes option to tox
* Uses pyflakes wrapper to ignore gettext errors * Based on: https://bugs.launchpad.net/pyflakes/+bug/844592 Change-Id: I4fd947176f5258f89f517acf5dda2ded4a2da15e
This commit is contained in:
parent
ca1a2566d3
commit
65ee45c641
22
tools/flakes.py
Normal file
22
tools/flakes.py
Normal file
@ -0,0 +1,22 @@
|
||||
import __builtin__
|
||||
import os
|
||||
import sys
|
||||
|
||||
from pyflakes.scripts.pyflakes import main
|
||||
|
||||
"""
|
||||
wrapper for pyflakes to ignore gettext based warning:
|
||||
"undefined name '_'"
|
||||
|
||||
From https://bugs.launchpad.net/pyflakes/+bug/844592
|
||||
"""
|
||||
|
||||
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())
|
4
tox.ini
4
tox.ini
@ -35,6 +35,10 @@ deps = -r{toxinidir}/tools/pip-requires
|
||||
pylint==0.26.0
|
||||
commands = bash tools/lintstack.sh
|
||||
|
||||
[testenv:pyflakes]
|
||||
deps = pyflakes
|
||||
commands = python tools/flakes.py nova
|
||||
|
||||
[testenv:cover]
|
||||
setenv = NOSE_WITH_COVERAGE=1
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user