import pytest
if __name__=='__main__':
# pytest.main(['../test_case/test_case_01.py'])
pytest.main(['../test_case/','--html=../report/report.html'])
当运行以上代码时,提示了
ERROR: usage: run_all_case.py [options] [file_or_dir] [file_or_dir] [...]
之所以被报错,是因为pytest方法中 --html是需要单独安装pytest-html库的,解决方法如下
原因:可能是缺少该命令
解决方案 :pip install pytest-html
同理
allure报错时的解决方法:
解决方案 :pip install allure-pytest