]> gitweb.fperrin.net Git - djsite.git/blobdiff - quotes/test_pyflakes.py
Convert to using pytest
[djsite.git] / quotes / test_pyflakes.py
index 535c13a07bc2255883a236d685407374610f7bcb..7082ee032756140e394d10721797d2d9effb6760 100644 (file)
@@ -1,12 +1,12 @@
-from django.test import TestCase
-
+import pytest
 import pyflakes.api
 import os
 
-class PyflakesTest(TestCase):
-    def setUp(self):
+class Test_Pyflakes(object):
+    @pytest.fixture
+    def pyfiles(self):
         topdir = os.path.dirname(os.path.realpath(__file__))
-        self.pythonfiles = []
+        pythonfiles = []
 
         for folder, subfolders, files in os.walk(topdir):
             if 'migrations' in subfolders:
@@ -15,8 +15,9 @@ class PyflakesTest(TestCase):
             for file in files:
                 if not file.endswith('.py'):
                     continue
-                self.pythonfiles += [os.path.join(folder, file)]
+                pythonfiles += [os.path.join(folder, file)]
+        return pythonfiles
     
-    def test_pyflakes(self):
-        for file in self.pythonfiles:
-            self.assertEqual(pyflakes.api.checkPath(file), 0)
+    def test_pyflakes(self, pyfiles):
+        for file in pyfiles:
+            assert pyflakes.api.checkPath(file) == 0