Google Push-To-Deploy Pipelines - Unit Test Failures with Module Import Failure

I get the following error when I try to build on the Jenkins servers provided by Google in the Compute Engine.

[deployment_5371449468518400_1411607125060] $ /bin/sh -xe /tmp/hudson807438832151987098.sh
+ nosetests --with-xunit --xunit-file=nosetests.xml
E
======================================================================
ERROR: Failure: ImportError (No module named google.appengine.ext)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 414, in loadTestsFromName
    addr.filename, addr.module)
  File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/var/jenkins/workspace/deployment_5371449468518400_1411607125060/tests.py", line 9, in <module>
    from google.appengine.ext import ndb
ImportError: No module named google.appengine.ext

----------------------------------------------------------------------
Ran 1 test in 0.448s

I am sure this is due to the next line in my test.py

from google.appengine.ext import ndb

Please, help.

I am including a link in a document containing more detailed information

+4
source share
1 answer

Joseph, since the path is not set correctly, add it to the beginning of the tests.py file:

import sys
sys.path.append("/google-cloud-sdk/platform/google_appengine")

Please do not forget to add this part before trying to import anything from this library, since the path has not yet been configured.

:

import sys
sys.path.append("/google-cloud-sdk/platform/google_appengine")

some other imports
#next import ONLY after the path has been updated to point to the App Engine libraries
from google.appengine.ext import ndb
0

All Articles