Chapter 8. Testing and Deploying an API with Flask

In this chapter, we will configure, write, and execute unit tests and learn a few things related to deployment. We will:

  • Set up unit tests
  • Create a database for testing
  • Write a first round of unit tests
  • Run unit tests and check testing coverage
  • Improve testing coverage
  • Understand strategies for deployments and scalability

Setting up unit tests

We will use nose2 to make it easier to discover and run unit tests. We will measure test coverage, and therefore, we will install the necessary package to allow us to run coverage with nose2. First, we will install the nose2 and cov-core packages in our virtual environment. The cov-core package will allow us to measure test coverage with nose2. Then, we will create ...

Get Building RESTful Python Web Services now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.