#8763: modeltests/generic_relations may fail since TaggedItem ordering is not
completely specified
--------------------------------------------------------------+-------------
 Reporter:  Richard Davies <[EMAIL PROTECTED]>  |       Owner:  nobody    
   Status:  new                                               |   Milestone:  
1.0       
Component:  Unit test system                                  |     Version:  
SVN       
 Keywords:                                                    |       Stage:  
Unreviewed
Has_patch:  1                                                 |  
--------------------------------------------------------------+-------------
 modeltests/generic_relations fails on one of my systems, while it works on
 others. The reason is that there is a test on TaggedItem.objects.all(),
 and the order of the items returned by all() may vary.

 I attach a very simple patch to guarantee that the ordering is as expected
 by the test case.

 The error:

 {{{
 $ ./runtests.py --settings=SETT_postgresql_psycopg2 generic_relations
 ======================================================================
 FAIL: Doctest: modeltests.generic_relations.models.__test__.API_TESTS
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/home/elastic/django-dev/trunk/django/test/_doctest.py", line
 2180, in runTest
     raise self.failureException(self.format_failure(new.getvalue()))
 AssertionError: Failed doctest test for
 modeltests.generic_relations.models.__test__.API_TESTS
   File "/home/elastic/django-
 dev/trunk/tests/modeltests/generic_relations/models.py", line unknown line
 number, in API_TESTS

 ----------------------------------------------------------------------
 File "/home/elastic/django-
 dev/trunk/tests/modeltests/generic_relations/models.py", line ?, in
 modeltests.generic_relations.models.__test__.API_TESTS
 Failed example:
     [(t.tag, t.content_type, t.object_id) for t in
 TaggedItem.objects.all()]
 Expected:
     [(u'clearish', <ContentType: mineral>, 1), (u'fatty', <ContentType:
 vegetable>, 2), (u'fatty', <ContentType: animal>, 1), (u'hairy',
 <ContentType: animal>, 2), (u'salty', <ContentType: vegetable>, 2),
 (u'shiny', <ContentType: animal>, 1), (u'yellow', <ContentType: animal>,
 2)]
 Got:
     [(u'clearish', <ContentType: mineral>, 1), (u'fatty', <ContentType:
 animal>, 1), (u'fatty', <ContentType: vegetable>, 2), (u'hairy',
 <ContentType: animal>, 2), (u'salty', <ContentType: vegetable>, 2),
 (u'shiny', <ContentType: animal>, 1), (u'yellow', <ContentType: animal>,
 2)]
 ----------------------------------------------------------------------
 File "/home/elastic/django-
 dev/trunk/tests/modeltests/generic_relations/models.py", line ?, in
 modeltests.generic_relations.models.__test__.API_TESTS
 Failed example:
     [(t.tag, t.content_type, t.object_id) for t in
 TaggedItem.objects.all()]
 Expected:
     [(u'clearish', <ContentType: mineral>, 1), (u'fatty', <ContentType:
 vegetable>, 2), (u'fatty', <ContentType: animal>, 1), (u'salty',
 <ContentType: vegetable>, 2), (u'shiny', <ContentType: animal>, 1)]
 Got:
     [(u'clearish', <ContentType: mineral>, 1), (u'fatty', <ContentType:
 animal>, 1), (u'fatty', <ContentType: vegetable>, 2), (u'salty',
 <ContentType: vegetable>, 2), (u'shiny', <ContentType: animal>, 1)]
 ----------------------------------------------------------------------
 File "/home/elastic/django-
 dev/trunk/tests/modeltests/generic_relations/models.py", line ?, in
 modeltests.generic_relations.models.__test__.API_TESTS
 Failed example:
     [(t.tag, t.content_type, t.object_id) for t in
 TaggedItem.objects.all()]
 Expected:
     [(u'clearish', <ContentType: mineral>, 1), (u'fatty', <ContentType:
 vegetable>, 2), (u'fatty', <ContentType: animal>, 1), (u'salty',
 <ContentType: vegetable>, 2), (u'shiny', <ContentType: animal>, 1)]
 Got:
     [(u'clearish', <ContentType: mineral>, 1), (u'fatty', <ContentType:
 animal>, 1), (u'fatty', <ContentType: vegetable>, 2), (u'salty',
 <ContentType: vegetable>, 2), (u'shiny', <ContentType: animal>, 1)]


 ----------------------------------------------------------------------
 Ran 1 test in 0.319s

 FAILED (failures=1)
 }}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/8763>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to