Running unit tests with nose2 and checking testing coverage

Now, run the following command to create all the necessary tables in our test database and use the nose2 test running to execute all the tests we created. The test runner will execute all the methods for our InitialTests class that start with the test_ prefix and will display the results.

Tip

The tests won't make changes to the database we have been using when working on the API. Remember that we configured the test_messages database as our test database.

Remove the api.py file we created in the previous chapter from the api folder because we don't want the tests coverage to take into account this file. Go to the api folder and run the following command within the same virtual environment ...

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.