py.test tool makes it very easy to write tests and run them. There are a few other options such as
nose and the bundled
unittest module available, but the
py.test library offers a very good combination of usability and active development. In the past, I was an avid
nose user but have since switched to
py.test as it tends to be easier to use and has better community support, in my experience at least. Regardless,
nose is still a good choice, and if you're already using it, there is little reason to switch and rewrite all of your tests. When writing tests for a new project, however,
py.test can be much more convenient.
Now, we will run the doctests from the previously discussed
square.py file using
First, start by ...