Flask and unit testing

You may be thinking: "Unit tests look great for small sections of code, but how do you test it for an entire Flask app?" Well one of the ways, as mentioned previously, is to make sure that all your methods are as discrete as possible—that is, to make sure your methods do the least possible work to complete their function, and to avoid repetition between methods. If your methods are not discrete, now is a good time to get them tidied up.

Another thing that will help is that Flask comes readymade for unit testing. There is a good chance that any existing application can have at least some unit tests applied to it. Especially, any areas of API such as in unable to verify will be extremely easy to test by making use of the methods ...

Get Learning Flask Framework 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.