Running tests

Now we have created our test, we need to run it. Fortunately, this is very easy to do, jump into your terminal and type:

python manage.py test books 

After a moment, Django should print out something like this:

Creating test database for alias 'default'... F ====================================================================== FAIL: test_recent_pub (books.tests.BookMethodTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\Users\Nigel\ ... mysite\books\tests.py", line 25, in test_recent_pub self.assertEqual(future_pub.recent_publication(), False) AssertionError: True != False ---------------------------------------------------------------------- Ran 1 test in 0.000s ...

Get Mastering Django: Core now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.