]> gitweb.fperrin.net Git - djsite.git/blobdiff - quotes/test_pyflakes.py
Add a pyflakes check, and fix the warnings
[djsite.git] / quotes / test_pyflakes.py
diff --git a/quotes/test_pyflakes.py b/quotes/test_pyflakes.py
new file mode 100644 (file)
index 0000000..535c13a
--- /dev/null
@@ -0,0 +1,22 @@
+from django.test import TestCase
+
+import pyflakes.api
+import os
+
+class PyflakesTest(TestCase):
+    def setUp(self):
+        topdir = os.path.dirname(os.path.realpath(__file__))
+        self.pythonfiles = []
+
+        for folder, subfolders, files in os.walk(topdir):
+            if 'migrations' in subfolders:
+                subfolders.remove('migrations')
+
+            for file in files:
+                if not file.endswith('.py'):
+                    continue
+                self.pythonfiles += [os.path.join(folder, file)]
+    
+    def test_pyflakes(self):
+        for file in self.pythonfiles:
+            self.assertEqual(pyflakes.api.checkPath(file), 0)