Mi chiedo se esiste un plug-in per il naso per pylint e/o pyflakes?Esiste un plugin per pylint e pyflakes per i test del naso?
Attualmente sto usando i plugin coverage e tissue (PEP8) per i test del naso.
Tnx in anticipo
Mi chiedo se esiste un plug-in per il naso per pylint e/o pyflakes?Esiste un plugin per pylint e pyflakes per i test del naso?
Attualmente sto usando i plugin coverage e tissue (PEP8) per i test del naso.
Tnx in anticipo
Una volta ho scritto un generatore di prova che utilizza pyflakes. Non è un plugin naso, ma era abbastanza vicino per il mio bisogno:
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)
I casi di test produce test
funzione per ogni file Python all'interno della directory contenente your_application
. È possibile regolare TOP
come necessario per testare altre directory.