#32012: Test runner setup_databases crashes with "TEST": {"MIGRATE": False}.
-------------------------------------+-------------------------------------
     Reporter:  Jaap Roes            |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Testing framework    |                  Version:  3.1
     Severity:  Release blocker      |               Resolution:
     Keywords:  testrunner crash     |             Triage Stage:  Accepted
  setup database migrations          |
  disabled                           |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Jaap Roes):

 That seems similar to the solution I've been using for a while:

 {{{
 class NoMigrations:
     """Disable migrations for all apps"""

     def __getitem__(self, item):
         return None

     def __contains__(self, item):
         return True

 MIGRATION_MODULES = NoMigrations()
 }}}

 (Which I also suggested it as a temporary solution in the original ticket
 https://code.djangoproject.com/ticket/25388#comment:20)

 I hadn't actually tried this `MIGRATION_MODULES` override on this project
 before. I just did a test run with the override and or some reason I had
 to add a `fixtures = ['myapp/initial_data.json']` line to some of the
 `TestCase` classes that worked fine without it before. It seems that these
 test cases really needed this fixture, but for some reason worked fine
 when migrations are enabled. Is (test) fixture loading somehow tied to
 migrations?

 Anyway, the tests work fine (the same 3 failures) with the
 `MIGRATION_MODULES` override, so it seems like it would be a reasonable
 alternative solution.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32012#comment:3>
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.df32381efc46e37816a1943e9cce6e1c%40djangoproject.com.

Reply via email to