Monday, September 5, 2011

Re: Beginner's unit test question

I'm sorry for my inconsistency. I tried to "simplify", but made a
mistake. In fact, I used the app "messages" throughout, in my code
and in the test command. The project containing the app works fine.
In particular, the app "messages" is included in INSTALLED_APPS.

So, if the test "should work" as I've written it, can anyone suggest
what might be wrong? Django configuration error? Settings error?
Permissions error? Something else?

On Sep 5, 11:48 pm, bruno desthuilliers
<bruno.desthuilli...@gmail.com> wrote:
> On Sep 5, 5:18 am, Rodney Topor <r.to...@gmail.com> wrote:
>
>
>
>
>
> > 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.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate