简体   繁体   English

如何自动销毁django测试数据库

[英]How to automatically destroy django test database

I'm currently trying to automate django tests using hudson, and am struggling to find an option that will automatically destroy the test database if it already exists (typically it will ask for confirmation to destroy it, which the automatic testing obviously cannot provide for). 我目前正在尝试使用hudson自动化django测试,并且我很难找到一个选项,如果它已经存在,它会自动销毁测试数据库(通常它会要求确认销毁它,自动测试显然无法提供) 。

Any suggestions would be much appreciated! 我们欢迎所有的建议!

Cheers, R 干杯,R

Use --help to see the docs of the test command: 使用--help查看test命令的文档:

>>> ./manage.py test --help   
Usage: ./manage.py test [options] [appname ...]

Runs the test suite for the specified applications, or the entire site if no apps are specified.

[...]

--noinput             Tells Django to NOT prompt the user for input of any
                      kind.

And use --noinput which defaults to destroying the test db;) 并使用--noinput默认破坏测试数据库;)

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

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