Our travis.yml as follows:
language: python python: - "2.7" env: - "MONGO_URL=mongodb://localhost/" services: mongodb # command to install dependencies install: "pip install -r requirements.txt" # command to run tests script: nosetests
Then in python script with tests line
server.connect(os.environ['MONGO_URL'])
gives an error (in abbreviated form):
File "/home/travis/virtualenv/python2.7/lib/python2.7/UserDict.py", line 23, in __getitem__ raise KeyError(key)
This error occurs only on travis. If we run them locally, this works without problems. Therefore, we assume that we have set the environment variable MONGO_URL . We already tried quotation marks, but that didn't help.
Any clues? We use the free cloud service travis-ci.
source share