Can Pytest run at a pre-scheduled time?

橙三吉。 提交于 2019-12-24 01:01:49

问题


I am using pytest to run my tests using python3 script like below:

pytest -s test_file.py | tee -a myoutput.log

It works. Now I would like to run this at a specific time everyday, I tried "crontab -e" from linux console but failed. I mean there is no log added to "myoutput.log" file. Can anyone please help? thanks!

42 00 * * * /usr/bin/pytest pytest -s /data/smc/test_file.py | tee -a myoutput.log

回答1:


I think it can be done by using cron output. eg:

42 00 * * * /usr/bin/pytest pytest -s /data/smc/test_file.py >> /Your-log-path.log 2>&1



来源:https://stackoverflow.com/questions/53291608/can-pytest-run-at-a-pre-scheduled-time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!