Ich frage mich, ob es ein Nase-Plugin für Pyint und/oder Pyflakes gibt?Gibt es ein Plugin für Pylint und Pyflakes für Nasentests?
Momentan verwende ich coverage und tissue (PEP8) Plugins für Nasentests.
Tnx im Voraus
Ich frage mich, ob es ein Nase-Plugin für Pyint und/oder Pyflakes gibt?Gibt es ein Plugin für Pylint und Pyflakes für Nasentests?
Momentan verwende ich coverage und tissue (PEP8) Plugins für Nasentests.
Tnx im Voraus
Ich schrieb einmal einen Testgenerator, der Pyflakes verwendet. Es ist keine Nose-Plugin, aber es war nahe genug für mein Bedürfnis:
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)
Die test
Funktion Ausbeuten Testfälle für jede Python-Datei im Verzeichnis mit your_application
. Sie können TOP
nach Bedarf anpassen, um andere Verzeichnisse zu testen.