Permalink
Browse files

Add pyflakes to tox.ini

Add the ability to use pyflakes.

Change-Id: I1c0a652258fd494bf6754b5b83c47166582a85d0
Signed-off-by: Chuck Short <chuck.short@canonical.com>
  • Loading branch information...
Chuck Short
Chuck Short committed Dec 22, 2012
1 parent daf3bda commit a0e06a8e96ccfeee1de0030da0a1a2ac9e6e5aad
Showing with 26 additions and 0 deletions.
  1. +22 −0 tools/flakes.py
  2. +4 −0 tox.ini
View
@@ -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
@@ -27,3 +27,7 @@ setenv = NOSE_WITH_COVERAGE=1
[testenv:venv]
commands = {posargs}
+
+[testenv:pyflakes]
+deps = pyflakes
+commands = python tools/flakes.py keystone

0 comments on commit a0e06a8

Please sign in to comment.