0

I'm new to Jenkins and I'm trying to schedule a Jenkins job to run Python unit tests. The modules being tested import gcloud.datastore, but I'm getting an error: No module named gcloud.datastore when trying to run the Jenkins job. I've installed the GCloud SDK Plugin for jenkins, but I'm not sure how to resolve the issue.

I'm running the following in Jenkins under Build->Virtualenv Builder to install the dependencies for my tests and then run them. (I'm sure there's a better way to run the unit tests, but I'll work on that later.)

pip install -r /vagrant/requirements.txt
python /vagrant/run_test.py -A

The error occurs when executing run_test.py. Since GCloud SDK can't be installed using pip, putting it in the requirements.txt file doesn't work so I'm not sure how to do this.

GCloud SDK is installed on my VM in the directory /vagrant/google-cloud-sdk/bin/gcloud, but Jenkins doesn't seem to care.

As a side note: the tests themselves mock the methods that access datastore so the gcloud.datastore library isn't being used for them, but the project itself needs it.

bossylobster
  • 9,993
  • 1
  • 42
  • 61
James B
  • 447
  • 3
  • 15
  • There are a few questions, what OS is your Jenkins running on? which version of Python are you using? How did you install it on a machine where it woks? The gcloud plugin is a bit light on instructions https://wiki.jenkins-ci.org/display/JENKINS/GCloud+SDK+Plugin maybe reach out to them directly – KeepCalmAndCarryOn Jan 19 '16 at 22:12
  • Jenkins is running on Ubuntu with Python version 2.7. The GCloud SDK was downloaded and the directory was put in the PATH and PYTHONPATH. I was just given the code, so I'm a little unfamiliar with it. – James B Jan 19 '16 at 23:21
  • @JamesB The `gcloud` SDK is not the Python library containing `gcloud.datastore` (now the import has moved to `google.cloud.datastore`) – bossylobster Sep 30 '16 at 00:10

0 Answers0