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

Nose library integration


Nose is a library that makes testing easier and much more fun. It provides a whole lot of tools to enhance our tests. Although Nose can be used for multiple purposes, the most important usage remains that of a test collector and runner. Nose automatically collects tests from Python source files, directories, and packages found in the current working directory. We will focus on how to run individual tests using Nose rather than the whole bunch of tests every time.

Getting ready

First, we need to install the Nose library:

$ pip install nose

How to do it…

We can execute all the tests in our application using Nose by running the following command:

$ nosetests -v
Test creation of new category ... ok
Test creation of new product ... ok
Test home page ... ok
Test Products list page ... ok
Test searching product ... ok
--------------------------------------------------------------------
Ran 5 tests in 0.399s

OK

This will pick out all the tests in our application and run them...