5
pylint 및/또는 pyflakes의 코 플러그가 있는지 궁금합니다.코 테스트를위한 pylint 및 pyflakes 용 플러그인이 있습니까?
현재 코 테스트를 위해 coverage 및 tissue (PEP8) 플러그인을 사용하고 있습니다. 사전
pylint 및/또는 pyflakes의 코 플러그가 있는지 궁금합니다.코 테스트를위한 pylint 및 pyflakes 용 플러그인이 있습니까?
현재 코 테스트를 위해 coverage 및 tissue (PEP8) 플러그인을 사용하고 있습니다. 사전
에서
TNX
내가 한 번 Pyflakes를 사용하는 시험 발생기를 썼다. 그것은 코 플러그인은 아니지만, 내 필요에 충분히 가까이 :your_application
를 포함하는 디렉토리 내의 각 파이썬 파일
import os
import _ast
from pyflakes import checker
import your_application
TOP = os.path.dirname(os.path.dirname(your_application.__file__))
class PyflakesError(AssertionError):
def __str__(self):
path = self.args[0]
messages = self.args[1]
messages.sort(key=lambda m: m.lineno)
return 'checking %s\n' % path + '\n'.join(map(str, messages))
def check(path):
code = open(os.path.join(TOP, path)).read()
tree = compile(code, path, "exec", _ast.PyCF_ONLY_AST)
w = checker.Checker(tree, path)
if w.messages:
raise PyflakesError(path, w.messages)
def test():
for root, dirs, files in os.walk(TOP):
for name in files:
if not name.endswith('.py'):
continue
yield check, os.path.relpath(os.path.join(root, name), TOP)
def is_package(d):
return os.path.exists(os.path.join(root, d, '__init__.py'))
dirs[:] = filter(is_package, dirs)
test
기능 수율 테스트 케이스. 필요에 따라 TOP
을 조정하여 다른 디렉토리를 테스트 할 수 있습니다.