Python Unit Testing Quickstart
2012-08-20
Suppose you want to write some unit tests in Python. What do? Fortunately, you already have a module called unittest (or unittest2 in Python 2.4-2.6) in the standard library. We’ll use that.
Directory structure First, create a directory named tests. Place an empty file named init.py inside. This distinguishes the directory as a package.
Next, create your first test file and place it in the tests directory. I called mine test_database.
Read more →