1
使用pbr
簡化Python打包當我們執行python setup.py test
命令時,我們需要配置什麼以使其使用pytest
。當setup.py測試命令被調用時,如何告訴pbr使用pytest?
運行pytest
工作沒有任何問題。
使用pbr
簡化Python打包當我們執行python setup.py test
命令時,我們需要配置什麼以使其使用pytest
。當setup.py測試命令被調用時,如何告訴pbr使用pytest?
運行pytest
工作沒有任何問題。
在setup.py:
setup(
setup_requires=['pbr>=1.9', 'setuptools>=17.1', 'pytest-runner'],
pbr=True,
)
在setup.cfg(後標準PBR配置):
[aliases]
test=pytest
在測試requirements.txt(同一目錄requirements.txt):
pytest
如果您的測試不在應用程序代碼中,您還需要使用setup.c中的addopts指定您的測試目錄FG。例如,如果您的目錄結構看起來像this page上的第一個示例,則應該有
[tool:pytest]
addopts = tests