Setting up environment variables

Earlier in this chapter, you'll remember that there were some environment variables that we needed to take care of in our tests. Additionally, there was a small switch in our conftest.py file that set the PostgreSQL host based on the presence of a particular environment variable. CircleCI is kind enough to inject a couple of environment variables during a build, one of which is named CIRCLECI. Using this variable, we'll update the database host during test runs, which happens to be localhost. When we're testing our code locally with Docker containers that we manage, the hostname will be that of our linked PostgreSQL container.

In addition to handling specific environment variables differently when running ...

Get Serverless Design Patterns and Best Practices now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.