I’m triyng to tests some GAE models with nose and noseGAE plugin.
The tutorials show how to run the test using the webapp framework setup like in this tutorial
http://farmdev.com/projects/nosegae/ . But since I’m using django, my main.py is:
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
import django.core.handlers.wsgi
app = django.core.handlers.wsgi.WSGIHandler()
When I try to run nose:
$ nosetests --with-gae
I get:
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
I thought that it was because the django dependencies, bu next i tried to run a single file:
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()
Then:
$ python test_models.py
And:
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 info
release: 1.7.3
runtime: python27
Somebody knows what is going on here? Thanks.
I recommend this documentation. It shows an example how you can write a testrunner.py to load your test class, so you can have a mini test framework. Specifically, the following code is what you are looking for:
sdk_path is where your google_appengine sdk is located at. For instance, it could be /usr/local/google_appengine on linux.