我很难在 GAE 上运行 django 单元测试。我可能设置错了。
from django.test import TestCase
from django.test.utils import setup_test_environment
from django.test.client import Client
class Test_base(TestCase):
def setUp(self):
self.client = Client()
# First, create an instance of the Testbed class.
self.testbed = testbed.Testbed()
# Then activate the testbed, which prepares the service stubs for use.
self.testbed.activate()
# Next, declare which service stubs you want to use.
self.testbed.init_datastore_v3_stub()
self.testbed.init_mail_stub()
self.testbed.init_memcache_stub()
setup_test_environment()
def tearDown(self):
self.testbed.deactivate()
from test_base import Test_base
from nose.tools.trivial import eq_
class TestModels(Test_base):
def test_shout_exists(self):
eq_(1,2)
运行test_shout_exists
单元测试时,我收到以下错误消息:
Finding files... done.
Importing test modules ... done.
Error: Couldn't install apps, because there were errors in one or more models:
django.contrib.contenttypes: 'module' object has no attribute 'messages'
django.contrib.messages: No module named messages
django.contrib.admin: 'module' object has no attribute 'messages'
django.contrib.auth: 'module' object has no attribute 'messages'
django.contrib.staticfiles: No module named staticfiles
django.contrib.sessions: 'module' object has no attribute 'messages'
有什么提示吗?谢谢