Book Image

Flask Framework Cookbook

By : Shalabh Aggarwal
Book Image

Flask Framework Cookbook

By: Shalabh Aggarwal

Overview of this book

Table of Contents (19 chapters)
Flask Framework Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 10. Debugging, Error Handling, and Testing

Until now, in this book, we have concentrated on developing applications and adding features to them one at a time. It is very important to know how robust our application is and keep track of how the application has been working and performing. This, in turn, gives rise to the need of being informed when something goes wrong in the application. It is normal to miss out on certain edge cases while developing an application, and usually, even the test cases miss them out. It will be great to know these edge cases whenever they occur so that they can be handled accordingly.

Testing in itself is a very huge topic, and has several books attributed to it. Here, we will try to understand the basics of testing with Flask.

In this chapter, we will cover the following recipes:

  • Setting up basic file logging

  • Sending e-mails on the occurrence of errors

  • Using Sentry to monitor exceptions

  • Debugging with pdb

  • Creating our first simple test

  • Writing more tests for...