So I’m experiencing a weird issue that has me stumped.
I have an opensource library (see here) that wraps a third-party’s RESTful API. I’m running a series of tests in Python 3.7 on the xenial distribution, and the tests rely on an environment variable to authenticate against the third-party’s API. Tests pass locally using the configured environment variable. No problems.
In Travis CI, I have attempted two different things per TravisCI’s documentation:
-
I have configured the environment variable using the Travis CI web-based UI, setting it to be available in all branches (
TEST_API_KEY
andWALKSCORE_TEST_API_KEY
). -
I have configured an encrypted form of the environment variable within my
.travis.yml
file (WALKSCORE_TEST_API_KEY
).
When I view my job logs, it is clear that there are environment variable export statements for my secure/encrypted environment variables. Should be available to my code, right?
Alas, my code is unable to access the exported environment variables. For debug purposes, I even included a print statement in my tests to show me all of the environment variables available in my Python environment and no luck! The log shows all of the environment variables exported in the build environment, but for whatever reason these variables are not accessible to my Python code.
Here is a link to an example job build that shows the problem and also lists all of the environment variables accessible via Python: https://travis-ci.org/insightindustry/walkscore-api/jobs/578616366
Does anyone have any suggestions? I’m sure I’ve got something misconfigured somewhere, but my understanding is that configured environment variables should be available in the Python execution environment within my job.