A unit test is a piece of code that tests a unit of work or the logical unit in the tested system. The following are the characteristics of unit test cases:
- Automated: They should be executed automatically
- Independent: They shouldn't have any dependencies
- Consistent and repeatable: They should maintain idempotency
- Maintainable: They should be easy enough to understand and update
We will use a unit testing framework called nose. As an alternative, we can use docstest (https://docs.python.org/2/library/doctest.html) for testing.
So, let's install nose using pip with the following command:
$ pip install nose
Or, you can put it in requirement.txt, and use the following command to install it:
$ pip install -r requirements.txt ...