#16550: Django should load custom SQL when testing
-------------------------------------+-------------------------------------
               Reporter:             |          Owner:  nobody
  elver.loho@…                       |         Status:  reopened
                   Type:  New        |      Component:  Database layer
  feature                            |  (models, ORM)
              Milestone:             |       Severity:  Normal
                Version:  1.3        |       Keywords:
             Resolution:             |      Has patch:  0
           Triage Stage:             |    Needs tests:  0
  Unreviewed                         |  Easy pickings:  1
    Needs documentation:  0          |
Patch needs improvement:  0          |
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
Changes (by elver.loho@…):

 * status:  closed => reopened
 * resolution:  wontfix =>


Comment:

 Having to work around this deliberate limitation is moronic, not the core
 devs.

 Here is my proposal for how it should be implemented:

 {{{
 #!div style="font-size: 80%"
 Workable version:
   {{{#!python
 class CustomModelObjects(TestCase):

         sql = ["custom_types.sql"]
         fixtures = ["test_data.json"]

         def testQuantityWeight__mul__PricePerUnit__Normal(self):
                 qw = QuantityWeight(15, "t")
                 ppu = PricePerUnit(PriceWithCurrency(100, "EUR"), "t")
                 pwc = qw * ppu
                 self.failUnlessEqual(pwc, PriceWithCurrency(1500, "EUR"))
   }}}
 }}}

 The stuff in sql is always loaded before the test runs. Since this is a
 new feature, you can easily document that it CANNOT be used for loading
 custom data. If you know to put that line there, you've probably read the
 docs and already know this. Problem solved without any workarounds.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/16550#comment:4>
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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to