[Django] #24023: Apps with intial_data and migrations kill test runner

9 views
Skip to first unread message

Django

unread,
Dec 18, 2014, 5:01:08 PM12/18/14
to django-...@googlegroups.com
#24023: Apps with intial_data and migrations kill test runner
-----------------------------------+--------------------
Reporter: alexhayes | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.7
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------
It appears that in Django 1.7.1 when you run `manage.py test` it attempts
to `loaddata` for apps with `initial_data.*` prior(1) to the migrations
for those apps being applied.

According to the docs the loading of initial_data.* files has been
deprecated in 1.7.

I would expect and assume that this is true for running tests also,
however what happens is that the tests attempt to load the initial data
which results in a django.db.utils.OperationalError (essentially it
attempts to load the data but the tables don't exist).

I've created a github repo of a project that illustrates the issue and
contains a trace - see https://github.com/alexhayes/apps-with-migrations-
and-initial-data-break-tests

As outlined in the projects readme I would expect that the tests
completely ignore the initial_data.* files for apps that have migrations
(as migrate does now) and that I have to create a data migration, as
outlined in the documentation.

The obvious workaround for this is just remove the `initial_data.*` files
however it's not clear in the documentation that this is the case.

(1) Note, as detailed in my example github project, the migrations are
indeed run prior to load data, but they don't seem to be applied.

--
Ticket URL: <https://code.djangoproject.com/ticket/24023>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Dec 18, 2014, 5:39:47 PM12/18/14
to django-...@googlegroups.com
#24023: Apps with intial_data and migrations kill test runner
-----------------------------------+--------------------------------------
Reporter: alexhayes | Owner: nobody
Type: Bug | Status: closed

Component: Testing framework | Version: 1.7
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Changes (by timgraham):

* status: new => closed
* needs_docs: => 0
* resolution: => duplicate
* needs_tests: => 0
* needs_better_patch: => 0


Comment:

I believe this should be resolved by #23699 in yet to be released 1.7.2.
Can you please test with stable/1.7.x and reopen if not?

--
Ticket URL: <https://code.djangoproject.com/ticket/24023#comment:1>

Django

unread,
Jan 5, 2015, 11:54:22 PM1/5/15
to django-...@googlegroups.com
#24023: Apps with intial_data and migrations kill test runner
-----------------------------------+--------------------------------------
Reporter: alexhayes | Owner: nobody
Type: Bug | Status: closed

Component: Testing framework | Version: 1.7
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------

Comment (by alexhayes):

I can confirm that this issue has indeed been resolved in 1.7.2.

--
Ticket URL: <https://code.djangoproject.com/ticket/24023#comment:2>

Reply all
Reply to author
Forward
0 new messages