简体   繁体   English

自动运行Django单元测试

[英]Automatically run django unittests

I want to create a script to automatically run the tests in django. 我想创建一个脚本来自动在django中运行测试。 So I want to perform the equivalent of python manage.py test myapp within python and store wether the test failed or not as a variable. 所以我想在python中执行等效于python manage.py test myapp的操作,并将测试失败或不作为变量存储。

So if the test works: 因此,如果测试有效:

variable = True

if the test doesn't work: 如果测试不起作用:

variable = False

You can do this with your own test runner using suite_result . 您可以使用suite_result与自己的测试运行程序一起执行此操作 Related code here 相关代码在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM