Hi guys,
I'm relative new to python and google app engine so please bear with me.
OK so my problem is that I'm trying to run a test unit by following the
tutorial at
Webapp2<http://webapp-improved.appspot.com/guide/testing.html#request-blank>and
I keep getting the following error:
Traceback (most recent call last):
File "test.py", line 2, in <module>
import webapp2
ImportError: No module named webapp2
*This is is my app.yaml file:*
application: test-app
version: 1
runtime: python27
api_version: 1
threadsafe: true
- url: /.*
script: main.app
libraries:
- name: jinja2
version: latest
builtins:
- remote_api: on
*This is my main.py file:*
import webapp2
class HelloHandler(webapp2.RequestHandler):
def get(self):
self.response.write('Hello, world!')
app = webapp2.WSGIApplication([('/', HelloHandler)])
def main():
app.run()
if __name__ == '__main__':
main()
*and this is my test.py file:*
import unittest
import webapp2
# from the app main.py
import main
class TestHandlers(unittest.TestCase):
def test_hello(self):
# Build a request object passing the URI path to be tested.
# You can also pass headers, query arguments etc.
request = webapp2.Request.blank('/')
# Get a response for that request.
response = request.get_response(main.app)
# Let's check if the response is correct.
self.assertEqual(response.status_int, 200)
self.assertEqual(response.body, 'Hello, world!')
if __name__ == '__main__':
unittest.main()
My project file structure is something like:
(folder) test-app
app.yaml
index.yaml
main.py
test.py
And to run the 'test.py' I do:
$ cd test-app
$ python test.py
And then I get the error above..Can anyone point me in the right direction?
Thanks
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/groups/opt_out.