pycharm直接运行run.py文件, allure生成的报告都没有更新,需要手动删除旧报告后再次运行才可以
pytest.ini
[pytest]
testpaths = testcases/
addopts = --alluredir ./report/result --clean-alluredir
run.py主要代码
if __name__ == "__main__":
pytest.main(["-s", "./", "--capture=sys"]) # --capture=sys会把报错的情况写进测试报告中
os.system('allure generate ./report/result -o ./report/allure_html --clean-alluredir')
报错:
Allure: Target directory /Users/mac/Documents/GitHub/pytestDemo/./report/allure_html for the report is already in use, add a '--clean' option to overwrite
修改 run.py后正常
if __name__ == "__main__":
pytest.main(["-s", "./", "--capture=sys"]) # --capture=sys会把报错的情况写进测试报告中
os.system('allure generate ./report/result -o ./report/allure_html --clean')
即将
--clean-alluredir
改为
--clean
运行后,allure报告会自动更新!!!!!!