def check_quality(result):
"""Run quality tests on the given generated output."""
for dirpath, _dirnames, filenames in os.walk(str(result.project)):
pylintrc = str(result.project.join('pylintrc'))
for filename in filenames:
name = os.path.join(dirpath, filename)
if not name.endswith('.py'):
continue
try:
sh.pylint(name, rcfile=pylintrc)
sh.pylint(name, py3k=True)
sh.pycodestyle(name)
if filename != 'setup.py':
sh.pydocstyle(name)
sh.isort(name, check_only=True)
except sh.ErrorReturnCode as exc:
pytest.fail(str(exc))
tox_ini = result.project.join('tox.ini')
docs_build_dir = result.project.join('docs/_build')
try:
# Sanity check the generated Makefile
sh.make('help')
# quality check docs
sh.doc8(result.project.join("README.rst"), ignore_path=docs_build_dir, config=tox_ini)
sh.doc8(result.project.join("docs"), ignore_path=docs_build_dir, config=tox_ini)
except sh.ErrorReturnCode as exc:
pytest.fail(str(exc))
评论列表
文章目录