O'Reilly logo

Test-Driven Development with Django by Kevin Harvey

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Finally writing application code

Okay, we're finally at a place where we can write some of the application! Let's open up solos/views.py, erase what's there, and stub out our index function:

...
def index():
    pass

I'm being deliberately Spartan here, almost blindly letting the output of the test drive the code I write. Let's run the tests again:

$ python manage.py test
Creating test database for alias 'default'...
EE
=====================================================================
ERROR: test_root_url_uses_index_view (solos.tests.test_urls.SoloViewTestCase)
---------------------------------------------------------------------
...
 File "/Users/kevin/.virtualenvs/jmad/lib/python3.4/site-packages/django/core/urlresolvers.py", line 358, in resolve ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required