2011-05-28 48 views

回答

9

下面是关于测试的Django应用程序一个很好的指南: A Guide to Testing in Django

而且example app on github拆分试验形式意见模型成单独的文件,所以它是可能是你的一个很好的例子。

注意每个测试模块如何被在__init__.py的输入:

from polls.tests.forms import * 
from polls.tests.models import * 
from polls.tests.views import * 
+2

从Django 1.6开始,这不再有效。请参阅此答案以获取更新的解决方案:http://stackoverflow.com/a/20932450/15676 – 2014-10-03 11:47:24

相关问题