我正在使用鼻子和鼻子来测试App引擎中的烧瓶应用程序。我使用virtualenv。
测试用例如下所示:
import os
import unittest
from google.appengine.ext import testbed
from tickapp import app
class DemoTest(unittest.TestCase):
def setUp(self):
self.app = app.test_client()
self.testbed = testbed.Testbed()
self.testbed.activate()
self.testbed.init_all_stubs()
def teardown(self):
self.testbed.deactivate()
def test_home_page(self):
result = self.app.get('/')
self.assertEqual(result.status, "200 OK")
if __name__ == "__main__":
main()
使用:nosetests -v --with-gae tests
运行测试测试用例文件位于“tests”目录下。
堆栈跟踪:
Traceback (most recent call last):
File "/home/raj/gae_projects/tick/tests/test_users.py", line 13, in setUp
self.app = app.test_client()
File "/home/raj/gae_projects/tick/flask/app.py", line 781, in test_client
from flask.testing import FlaskClient as cls
ImportError: Loaded module flask.testing not found in sys.modules
感谢您的帮助。