#23125: Running test loads initial_data even on migrated app
-----------------------------------+----------------------------------
Reporter: patrice@… | Owner: nobody
Type: Uncategorized | Status: new
Component: Testing framework | Version: 1.7-rc-2
Severity: Normal | Keywords: test flush migration
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+----------------------------------
Documentation says that ''If an application uses migrations, there is no
automatic loading of fixtures''.
I think we can expect the same when running tests but it appears not to be
the case. After a little investigation I noticed:
- the ''test'' command calls the ''migrate'' commands with a parameter
''test_flush'' set to True:
https://github.com/django/django/blob/1.7c2/django/db/backends/creation.py#L374
- the ''migrate'' command calls ''flush'' command :
https://github.com/django/django/blob/1.7c2/django/core/management/commands/migrate.py#L135
- and the ''flush'' command runs ''loaddata'' with ''initial_data'' as a
''fixture_label'' :
https://github.com/django/django/blob/1.7c2/django/core/management/commands/flush.py#L86
This makes running tests fails as it tries to load data before the tables
had been created.
--
Ticket URL: <https://code.djangoproject.com/ticket/23125>
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/063.5d4875bec14cf65e5594005e2e47a436%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.