#22989: TestCase fixtures not found if inherited from other than first base 
class
-----------------------------------+----------------------
     Reporter:  vilcans            |      Owner:  nobody
         Type:  Uncategorized      |     Status:  new
    Component:  Testing framework  |    Version:  1.7-rc-1
     Severity:  Normal             |   Keywords:
 Triage Stage:  Unreviewed         |  Has patch:  0
Easy pickings:  0                  |      UI/UX:  0
-----------------------------------+----------------------
 This is a regression from 1.6.5, where I inherited the `fixtures`
 attribute from a mixin class. In 1.7c1, Django acts like the attribute
 isn't there.

 == How to reproduce ==

 {{{
 from django.test import TestCase


 class Mixin(object):
     fixtures = ('my_fixture',)


 class Base(TestCase):
     pass


 class FixtureTest(Base, Mixin):
     def test_dummy(self):
         pass

 }}}

 In 1.7c1, running this test gives no warning that the `my_fixture` doesn't
 exist, which shows that Django doesn't try to load it.

 == Workaround ==

 Swapping the order of the base classes like this gives the expected
 result:

 {{{
 class FixtureTest(Mixin, Base):
 }}}

 Now running the test, Django tries to load the fixture, as it should:

 {{{
 /usr/local/lib/python2.7/dist-
 packages/django/core/management/commands/loaddata.py:225: UserWarning: No
 fixture named 'my_fixture' found.
   warnings.warn("No fixture named '%s' found." % fixture_name)
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/22989>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/050.7c7ffd8466bf1bc0511f0b7f30da5039%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to