Background Image
Table of Contents Table of Contents
Previous Page  101 / 478 Next Page
Information
Show Menu
Previous Page 101 / 478 Next Page
Page Background

2. If you get a different error at this point, try restarting your dev server—it may have gotten confused by the

changes to the database happening under its feet.

I said “no” to the question about superusers—we don’t need one yet, but we will look at

it in a later chapter. For now we can refresh the page on

localhost

, see that our error is

gone, and try running the functional tests again:

2

AssertionError: '2: Use peacock feathers to make a fly' not found in ['1: Buy

peacock feathers', '1: Use peacock feathers to make a fly']

So close! We just need to get our list numbering right. Another awesome Django tem‐

plate tag,

forloop.counter

, will help here:

lists/templates/home.html.

{% for item in items %}

<tr><td>

{{ forloop.counter }}: {{ item.text }}

</td></tr>

{% endfor %}

If you try it again, you should now see the FT get to the end:

self.fail('Finish the test!')

AssertionError: Finish the test!

But, as it’s running, you may notice something is amiss, like in

Figure 5-3

.

Figure 5-3. There are list items left over from the last run of the test

Creating Our Production Database with migrate

|

73