無他,主要是安裝了pytest-sugar之后,使用pytest運行代碼,風格依然沒有變化,在此記錄一下
1. 安裝pytest-sugar
pip install pytest-sugar
2. 運行
安裝完成后,通過pytest運行代碼,sugar不生效,查看pytest-sugar官方文檔: https://pypi.org/project/pytest-sugar/
發現pytest-sugar需要有其他依賴(共3個):
-
Python 2.7, 3.4 or newer
-
pytest2.9.0 or newer
-
pytest-xdist 1.14 or above if you want the progress bar to work while running tests in parallel
我運行不生效的原因是:沒有安裝pytest-xdist,安裝后,運行生效
3.不使用sugar用法:
py.test -p no:sugar