I am new to Google engine and python, so please bear with me. I am trying to run the python unit test on gae for the first time, following the tutorial in Webapp2
But when I run the test, 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 my test.py file:
import unittest
import webapp2
import main
class TestHandlers(unittest.TestCase):
def test_hello(self):
request = webapp2.Request.blank('/')
response = request.get_response(main.app)
self.assertEqual(response.status_int, 200)
self.assertEqual(response.body, 'Hello, world!')
if __name__ == '__main__':
unittest.main()
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()
This 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
My current folder structure:
Test-app
app.yaml
main.py
test.py
index.yaml
And to run the test that I am running:
$ cd test-app
$ python test.py
Can someone point me in the direction of recording why I am getting the error message above and why I cannot run this simple test.
I tried to publish as much information as I could, I hope it will be enough for someone to give me a small hand.
Thanks.