2011-05-28 47 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

相關問題