我正在尝试将pylint所有.py文件的检查添加到testsetuptools 的过程中(也许我做错了什么,请纠正我).这就是我正在做的事情setup.py:
class MyTest(test):
def run_tests(self):
import pytest
import pylint
if (pylint.run_pylint()):
sys.exit(-1)
if (pytest.main(self.test_args)):
sys.exit(-1)
setup(
tests_require = ['pytest', 'pylint'],
cmdclass = {'test': MyTest},
...
Run Code Online (Sandbox Code Playgroud)
)
当我运行时python setup.py test输出看起来很糟糕..我做得对吗?
适用于我的配置:在setup.py中:
setup(
name='...',
setup_requires=['pytest-runner', 'pytest-pylint', ...],
tests_require=['pytest', 'pylint']
...
)
Run Code Online (Sandbox Code Playgroud)
在setup.cfg中:
[aliases]
test=pytest
[pytest]
addopts = --pylint --pylint-rcfile=...
Run Code Online (Sandbox Code Playgroud)
然后,您只需输入以下内容即可运行pylint:
python setup.py test
Run Code Online (Sandbox Code Playgroud)
如果您已经在使用py.test,您可以安装pytest-pylint并将其添加到您的setup.cfg:
[tool:pytest]
addopts = --pylint
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3386 次 |
| 最近记录: |