[英]Django manage.py test
When running: 运行时:
./manage.py test appname
How can I disable all the stats/logging/output after "OK"? 如何在“确定”后禁用所有统计信息/日志/输出?
I run many tests and constantly have to scroll up thousands of terminal lines to view results. 我运行了很多测试,不断滚动数千个终端线来查看结果。 Clearly, I am new to Python/Django and it's testing framework, so I would appreciate any help.
显然,我是Python / Django的新手,它是测试框架,所以我很感激任何帮助。
----------------------------------------------------------------------
Ran 2 tests in 2.133s
OK
1933736 function calls (1929454 primitive calls) in 2.133 seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 2.133 2.133 <string>:1(<module>)
30 0.000 0.000 0.000 0.000 <string>:8(__new__)
4 0.000 0.000 0.000 0.000 Cookie.py:315(_quote)
26 0.000 0.000 0.000 0.000 Cookie.py:333(_unquote)
10 0.000 0.000 0.000 0.000 Cookie.py:432(__init__)
28 0.000 0.000 0.000 0.000 Cookie.py:441(__setitem__)
.
.
.
2 0.000 0.000 0.000 0.000 {time.gmtime}
18 0.000 0.000 0.000 0.000 {time.localtime}
18 0.000 0.000 0.000 0.000 {time.strftime}
295 0.000 0.000 0.000 0.000 {time.time}
556 0.000 0.000 0.000 0.000 {zip}
If it helps, I am importing: 如果有帮助,我正在导入:
from django.utils import unittest
class TestEmployeeAdd(unittest.TestCase):
def setUp(self):
If you use a unix
-like shell (Mac does) you can use the head
command to do the trick like this: 如果您使用类似
unix
的shell(Mac会这样做),您可以使用head
命令执行以下操作:
python manage.py test appname | head -n 3
Switch the number 3
for the one you need to truncate the output after the OK
line. 在
OK
行之后,将数字3
切换为截断输出所需的数字。
Also you can test if you like more the output yielded by setting the verbosity
of the command to minimal like this: 此外,您可以通过将命令的
verbosity
设置为最小值来测试您是否更喜欢所产生的输出:
python manage.py test appname -v 0
Hope this helps! 希望这可以帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.