To see what a test error looks like, let's remove the failing doctest introduced in the previous section and introduce a different kind of mistake into our sample unit test. Let's assume that instead of wanting to test that
1 + 1 equals the literal
2, we want to test that it equals the result of a function,
sum_args, that is supposed to return the sum of its arguments. But we're going to make a mistake and forget to import that function. So change
self.failUnlessEqual(1 + 1, sum_args(1, 1))
Now when the tests are run we see:
kmt@lbox:/dj_projects/marketr$ python manage.py test survey Creating test database... Creating table auth_permission Creating table auth_group Creating table auth_user ...