1

我正在使用nose 和nose-gae 在App 引擎中测试烧瓶应用程序。我使用虚拟环境。

测试用例如下所示:

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 测试运行测试

测试用例文件位于“测试”目录下。

堆栈跟踪:

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

谢谢你的帮助。

4

0 回答 0