Pytest可以在预定时间运行吗?

时间:2018-11-14 00:48:43

标签: python-3.x scheduled-tasks pytest scheduler

我正在使用pytest通过python3脚本运行测试,如下所示:

cons = sun.misc.SharedSecrets.getJavaIOAccess().console();

有效。现在,我想每天在特定时间运行一次,我从Linux控制台尝试了“ crontab -e”,但是失败了。我的意思是没有日志添加到“ myoutput.log”文件。谁能帮忙吗?谢谢!

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

1 个答案:

答案 0 :(得分:0)

我认为可以通过使用cron输出来完成。例如:

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