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 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.