Sunday, September 4, 2011

Beginner's unit test question

I'm trying to use unit tests for the first time.

In app/tests.py I have:

import unittest
from django.test.client import Client

class IndexTest(unittest.TestCase):
def test_index(self):
client = Client()
response = client.get('/index/')
self.assertEqual(response.status_code, 200)

In the enclosing project directory, I write

manage.py test app.IndexTest

and get the error

"Test label 'messages.IndexTest' does not refer to a test"

I also tried "from django.utils import unittest" in tests.py but that
made no difference.

The command

manage.py test app

runs without error but ignores my test.

I thought I was following the instructions in the documentation, but
apparently not. What am I missing? Do I have to add some test app to
INSTALLED_APPS in settings.py?

Rodney

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate