Starting out

First, you need a copy of unittest.py: this is included with Python version 2.1, or available separately from http://pyunit.sourceforge.net. Together with unittest.py there is a module unittestgui.py, which implements a simple Tkinter interface to the testing framework.

Since the unittest gui isn't always available — not every Python installation includes Tkinter —I have rewritten the framework to use PyQt, and the PyQt version is available with this book. This version is also more stable when testing classes derived from QObject— the Tkinter unittest GUI has a nasty tendency to crash when running more than one test that's based on a QObject. The Qt unittest gui is a drop-in replacement, and the filename is unittestgui.py.

pyunit.py needs to be on your Python path; additionally, you might want to execute unittestgui.py by itself. It is often comfortable to create either an icon on your desktop for unittestgui.py, or to write a small startup script in your $HOME/bin directory.

Once you have the supporting odds and ends in place, you can start writing tests for your application.