#22834: The builtin migrations being the only way to do migrations breaks data
migrations/fixtures in tests
-------------------------------+------------------------
     Reporter:  gc@…           |      Owner:  nobody
         Type:  Uncategorized  |     Status:  new
    Component:  Migrations     |    Version:  1.7-beta-2
     Severity:  Normal         |   Keywords:
 Triage Stage:  Unreviewed     |  Has patch:  0
Easy pickings:  0              |      UI/UX:  0
-------------------------------+------------------------
 The docs say:


 When you run ./manage.py test, Django looks at the TEST_RUNNER setting to
 determine what to do. By default, TEST_RUNNER points to
 'django.test.runner.DiscoverRunner'. This class defines the default Django
 testing behavior. This behavior involves:

 Performing global pre-test setup.
 Looking for tests in any file below the current directory whose name
 matches the pattern test*.py.
 Creating the test databases.
 '''Running migrate to install models and initial data into the test
 databases.'''
 Running the tests that were found.
 Destroying the test databases.
 Performing global post-test teardown.

 This is not true. There is no way to have initial data in the database for
 testing. The process of creating the test database also flushes it.
 Previously, a common pattern was to have initial data in south migrations
 and this worked, since south came later. Now, it is impossible to have
 initial data for tests, without test fixtures.

 This is not documented in initial data, it says you can't use custom SQL
 for tests, but then it says you should use fixtures for tests, even though
 fixtures are deprecated for production use, which is... well, weird.
 Additionally, you cannot use data migrations, since those will be flushed
 as well.

 Finally, looking at the code:
 
https://github.com/django/django/blob/stable/1.7.x/django/db/backends/creation.py#L376

 I don't understand how this could work, since people that have
 transactions are now screwed, vs no transaction.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/22834>
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/056.773b79f9f3c57952b98be4355351f951%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to