X-Git-Url: https://gitweb.fperrin.net/?a=blobdiff_plain;f=quotes%2Ftest_pyflakes.py;h=7082ee032756140e394d10721797d2d9effb6760;hb=6bc7c03c1fa9c289e4fff457e5404bffbb595fe7;hp=535c13a07bc2255883a236d685407374610f7bcb;hpb=986f25ddd8f8a6cd28ad121e2f873ebbe928257d;p=djsite.git diff --git a/quotes/test_pyflakes.py b/quotes/test_pyflakes.py index 535c13a..7082ee0 100644 --- a/quotes/test_pyflakes.py +++ b/quotes/test_pyflakes.py @@ -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