我是triyng,用nose
和noseGAE
插件測試一些GAE模型。在本地測試GAE-python27-django項目
本教程演示如何使用本教程中的webapp
框架設置運行測試 http://farmdev.com/projects/nosegae/。但自從我使用Django,我main.py
是:
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
import django.core.handlers.wsgi
app = django.core.handlers.wsgi.WSGIHandler()
當我嘗試運行鼻子:
$ nosetests --with-gae
我得到:
Traceback (most recent call last):
File "c:\Python27\Scripts\nosetests-script.py", line 8, in <module>
load_entry_point('nose==1.2.1', 'console_scripts', 'nosetests')()
File "C:\Python27\lib\site-packages\nose-1.2.1-py2.7.egg\nose\core.py", line 118, in __init__
**extra_args)
File "C:\Python27\lib\unittest\main.py", line 94, in __init__
self.parseArgs(argv)
File "C:\Python27\lib\site-packages\nose-1.2.1-py2.7.egg\nose\core.py", line 135, in parseArgs
self.config.configure(argv, doc=self.usage())
File "C:\Python27\lib\site-packages\nose-1.2.1-py2.7.egg\nose\config.py", line 338, in configure
self.plugins.configure(options, self)
File "C:\Python27\lib\site-packages\nose-1.2.1-py2.7.egg\nose\plugins\manager.py", line 284, in configure
cfg(options, config)
File "C:\Python27\lib\site-packages\nose-1.2.1-py2.7.egg\nose\plugins\manager.py", line 99, in __call__
return self.call(*arg, **kw)
File "C:\Python27\lib\site-packages\nose-1.2.1-py2.7.egg\nose\plugins\manager.py", line 167, in simple
result = meth(*arg, **kw)
File "build\bdist.win32\egg\nosegae.py", line 80, in configure
ImportError: No module named dev_appserver
我認爲這是因爲django的依賴關係,然後我試圖運行單個文件:
import unittest
from google.appengine.ext import testbed
class TestServicios(unittest.TestCase):
def setUP(self):
self.testbed = testbed.Testbed()
self.testbed.activate()
self.testbed.init_datastore_v3_stub()
def tearDown(self):
self.testbed.deactivate()
if __name__ == '__main__':
unittest.main()
然後:
$ python test_models.py
和:
Traceback (most recent call last):
File "test_models.py", line 2, in <module>
from google.appengine.ext import testbed
ImportError: No module named google.appengine.ext
GAE信息 版本:1.7.3 運行:python27
有人知道這是怎麼回事?謝謝。
您是否嘗試過使用django的數據存儲或其他服務來嘗試某種類型的麻煩? – loki
當django模型與GAE原始數據庫模型不匹配時(比如使用事務),會有一些痛苦。另外,我正在使用django-nonrel與HRD。您的結果可能會因CloudSQL上的純django而異。 – dragonx