【发布时间】:2011-07-14 10:19:22
【问题描述】:
当我通过manage.py test 运行 django 测试时,有没有办法将结果输出到文本文件?
【问题讨论】:
-
manage.py test > results.txt有什么问题?
标签: django unit-testing testing text-files
当我通过manage.py test 运行 django 测试时,有没有办法将结果输出到文本文件?
【问题讨论】:
manage.py test > results.txt 有什么问题?
标签: django unit-testing testing text-files
在 linux 上,你可以这样做:
python manage.py test > stdout.txt 2> stderr.txt
将输出重定向到文件。
【讨论】:
仅限 Linux...
python manage.py test 2>&1 | tee -a test.txt
这会将stdout 和stderr 结果捕获为单个流,并且仍将输出发送到控制台。
输出重定向说明另见In the shell, what does " 2>&1 " mean?
和How do I write stderr to a file while using "tee" with a pipe? 的输出重定向方法略有不同
【讨论】: