> 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"
You were talking about an app named "app", not "messages"... Please
try to be as exact as possible.
> 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?
Nope. As long as your app is mentionned in INSTALLED_APPS (and you'd
have a different exception if it wasn't the case), this should work.
--
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.
No comments:
Post a Comment