[Django] #24919: Don't run migrations when running tests

22 views
Skip to first unread message

Django

unread,
Jun 4, 2015, 7:00:13 AM6/4/15
to django-...@googlegroups.com
#24919: Don't run migrations when running tests
-------------------------------+--------------------
Reporter: kairichard | Owner: nobody
Type: Uncategorized | Status: new
Component: Migrations | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
With large apps it takes too long to run all migrations if you just want
to run a single test or testcase. Furthermore keepdb is not an option if
you already use an in memory sqlite db.

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

Django

unread,
Jun 4, 2015, 7:19:31 AM6/4/15
to django-...@googlegroups.com
#24919: Don't run migrations when running tests
-------------------------------+--------------------------------------

Reporter: kairichard | Owner: nobody
Type: Uncategorized | Status: new
Component: Migrations | Version: 1.8
Severity: Normal | Resolution:
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 shaib):

* cc: andrewgodwin (added)
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

See [https://groups.google.com/d/msgid/django-
developers/CAFwN1urVVW3hOkuT2vdAbm5EVv4pVs7MEvM9ejBEejSorYCrAQ%40mail.gmail.com
discussion] and [https://github.com/django/django/pull/4729 PR]

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

Django

unread,
Jun 4, 2015, 7:48:40 AM6/4/15
to django-...@googlegroups.com
#24919: Add an option not to run migrations when running tests
-----------------------------+------------------------------------
Reporter: kairichard | Owner: nobody
Type: New feature | Status: new
Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

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

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

* stage: Unreviewed => Accepted
* type: Uncategorized => New feature
* version: 1.8 => master


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

Django

unread,
Jun 4, 2015, 5:28:13 PM6/4/15
to django-...@googlegroups.com
#24919: Add an option not to run migrations when running tests
-----------------------------+------------------------------------
Reporter: kairichard | Owner: nobody

Type: New feature | Status: new
Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

Comment (by shaib):

#24481 is very closely related (essentially, the same mechanism should be
used to generate SQL statements. For #24481, they should be printed; here,
executed).

--
Ticket URL: <https://code.djangoproject.com/ticket/24919#comment:3>

Django

unread,
Jul 12, 2015, 12:36:13 PM7/12/15
to django-...@googlegroups.com
#24919: Add an option not to run migrations when running tests
-----------------------------+----------------------------------------
Reporter: kairichard | Owner: andrewgodwin
Type: New feature | Status: assigned

Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* owner: nobody => andrewgodwin
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/24919#comment:4>

Django

unread,
Jul 12, 2015, 12:42:46 PM7/12/15
to django-...@googlegroups.com
#24919: Add an option not to run migrations when running tests
-----------------------------+----------------------------------------
Reporter: kairichard | Owner: andrewgodwin
Type: New feature | Status: assigned
Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

Comment (by andrewgodwin):

PR for this is up at https://github.com/django/django/pull/4986

--
Ticket URL: <https://code.djangoproject.com/ticket/24919#comment:5>

Django

unread,
Jul 21, 2015, 9:20:12 AM7/21/15
to django-...@googlegroups.com
#24919: Add an option not to run migrations when running tests
-----------------------------+----------------------------------------
Reporter: kairichard | Owner: andrewgodwin
Type: New feature | Status: assigned
Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

Comment (by Tim Graham <timograham@…>):

In [changeset:"04e69598de75550a9227bfac353ff5606b6cbe43" 04e69598]:
{{{
#!CommitTicketReference repository=""
revision="04e69598de75550a9227bfac353ff5606b6cbe43"
Refs #24919 -- Made test models serializable for migrations.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24919#comment:6>

Django

unread,
Jul 21, 2015, 9:20:12 AM7/21/15
to django-...@googlegroups.com
#24919: Add an option not to run migrations when running tests
-----------------------------+----------------------------------------
Reporter: kairichard | Owner: andrewgodwin
Type: New feature | Status: assigned
Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

Comment (by Tim Graham <timograham@…>):

In [changeset:"b60375d4bbb848af7950379e2f35a1a65f7a2591" b60375d4]:
{{{
#!CommitTicketReference repository=""
revision="b60375d4bbb848af7950379e2f35a1a65f7a2591"
Fixed #25129 -- Made model instance defaults work with migrations (refs
#24919).
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24919#comment:7>

Django

unread,
Aug 9, 2015, 2:57:48 PM8/9/15
to django-...@googlegroups.com
#24919: Add an option not to run migrations when running tests
-----------------------------+----------------------------------------
Reporter: kairichard | Owner: andrewgodwin
Type: New feature | Status: assigned
Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* cc: cmawebsite@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/24919#comment:8>

Django

unread,
Sep 9, 2015, 9:02:53 PM9/9/15
to django-...@googlegroups.com
#24919: Add an option not to run migrations when running tests
-----------------------------+----------------------------------------
Reporter: kairichard | Owner: andrewgodwin
Type: New feature | Status: assigned
Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

Comment (by MarkusH):

@andrewgodwin what's your thought about
https://github.com/django/django/pull/5255

--
Ticket URL: <https://code.djangoproject.com/ticket/24919#comment:9>

Django

unread,
Sep 9, 2015, 11:42:54 PM9/9/15
to django-...@googlegroups.com
#24919: Add an option not to run migrations when running tests
-----------------------------+----------------------------------------
Reporter: kairichard | Owner: andrewgodwin
Type: New feature | Status: assigned
Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: 1.9 | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* keywords: => 1.9
* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/24919#comment:10>

Django

unread,
Sep 10, 2015, 2:51:40 PM9/10/15
to django-...@googlegroups.com
#24919: Add an option not to run migrations when running tests
-----------------------------+----------------------------------------
Reporter: kairichard | Owner: andrewgodwin
Type: New feature | Status: assigned
Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: 1.9 | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

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

* needs_better_patch: 0 => 1


Comment:

Added some ideas for improvement to the PR.

As I mentioned in IRC, it could also be useful to allow the
`DATABASES['TEST']['MIGRATE'] = False` option that Andrew's first PR
suggested to be a shortcut for setting `MIGRATION_MODULES = {'a': None,
'b': None', ...}` for all apps. This could be done later or in a separate
commit though. The main concern I have with this idea is whether or not it
makes sense in a multi-db situation.

--
Ticket URL: <https://code.djangoproject.com/ticket/24919#comment:11>

Django

unread,
Sep 11, 2015, 12:44:00 PM9/11/15
to django-...@googlegroups.com
#24919: Add an option not to run migrations when running tests
-----------------------------+---------------------------------------------

Reporter: kairichard | Owner: andrewgodwin
Type: New feature | Status: assigned
Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: 1.9 | Triage Stage: Ready for checkin

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

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

* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/24919#comment:12>

Django

unread,
Sep 11, 2015, 9:51:48 PM9/11/15
to django-...@googlegroups.com
#24919: Add an option not to run migrations when running tests
-----------------------------+---------------------------------------------
Reporter: kairichard | Owner: andrewgodwin
Type: New feature | Status: closed
Component: Migrations | Version: master
Severity: Normal | Resolution: fixed

Keywords: 1.9 | Triage Stage: Ready for checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------+---------------------------------------------
Changes (by Markus Holtermann <info@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"a3c01b0dd8060f00a5ffd2589a776b4f618af6d9" a3c01b0]:
{{{
#!CommitTicketReference repository=""
revision="a3c01b0dd8060f00a5ffd2589a776b4f618af6d9"
Fixed #24919 -- Allowed disabling of migrations on a per app basis
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24919#comment:13>

Django

unread,
Sep 11, 2015, 9:51:48 PM9/11/15
to django-...@googlegroups.com
#24919: Add an option not to run migrations when running tests
-----------------------------+---------------------------------------------
Reporter: kairichard | Owner: andrewgodwin
Type: New feature | Status: closed
Component: Migrations | Version: master
Severity: Normal | Resolution: fixed
Keywords: 1.9 | Triage Stage: Ready for checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

Comment (by Markus Holtermann <info@…>):

In [changeset:"f45ee1974696c8fc17ccfe12ef9e4188e29543a2" f45ee197]:
{{{
#!CommitTicketReference repository=""
revision="f45ee1974696c8fc17ccfe12ef9e4188e29543a2"
Refs #24919 -- Raised more helpful error message for disabled migrations
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24919#comment:14>

Django

unread,
Sep 11, 2015, 9:56:30 PM9/11/15
to django-...@googlegroups.com
#24919: Add an option not to run migrations when running tests
-----------------------------+---------------------------------------------
Reporter: kairichard | Owner: andrewgodwin
Type: New feature | Status: closed
Component: Migrations | Version: master
Severity: Normal | Resolution: fixed
Keywords: 1.9 | Triage Stage: Ready for checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

Comment (by MarkusH):

Replying to [comment:11 timgraham]:


> Added some ideas for improvement to the PR.
>
> As I mentioned in IRC, it could also be useful to allow the
`DATABASES['TEST']['MIGRATE'] = False` option that Andrew's first PR
suggested to be a shortcut for setting `MIGRATION_MODULES = {'a': None,
'b': None', ...}` for all apps. This could be done later or in a separate
commit though. The main concern I have with this idea is whether or not it
makes sense in a multi-db situation.

I created #25388 to keep track of this proposal if somebody wants to work
on it.

--
Ticket URL: <https://code.djangoproject.com/ticket/24919#comment:15>

Django

unread,
Jan 25, 2016, 10:01:45 PM1/25/16
to django-...@googlegroups.com
#24919: Add an option not to run migrations when running tests
-----------------------------+---------------------------------------------
Reporter: kairichard | Owner: andrewgodwin
Type: New feature | Status: closed
Component: Migrations | Version: master
Severity: Normal | Resolution: fixed
Keywords: 1.9 | Triage Stage: Ready for checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

Comment (by Simon Charette <charette.s@…>):

In [changeset:"477274acb46b2f07666e9f84dea2e65ea6b63ad3" 477274ac]:
{{{
#!CommitTicketReference repository=""
revision="477274acb46b2f07666e9f84dea2e65ea6b63ad3"
Refs #24919 -- Used the documented way of disabling migrations per app.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24919#comment:17>

Django

unread,
Jan 25, 2016, 10:01:46 PM1/25/16
to django-...@googlegroups.com
#24919: Add an option not to run migrations when running tests
-----------------------------+---------------------------------------------
Reporter: kairichard | Owner: andrewgodwin
Type: New feature | Status: closed
Component: Migrations | Version: master
Severity: Normal | Resolution: fixed
Keywords: 1.9 | Triage Stage: Ready for checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

Comment (by Simon Charette <charette.s@…>):

In [changeset:"4dcaa5871b70859952c6f9c437dfe1b5f10509f2" 4dcaa587]:
{{{
#!CommitTicketReference repository=""
revision="4dcaa5871b70859952c6f9c437dfe1b5f10509f2"
Fixed #26135 -- Adjusted the migration questioner's handling of disabled
apps.

This was causing an issue when calling the `migrate` command in a test
case with
the `available_apps` attribute pointing to an application with migrations
disabled using the `MIGRATION_MODULES` setting.

Thanks to Tim Graham for the review.

Refs #24919
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24919#comment:16>

Django

unread,
Jan 25, 2016, 10:54:48 PM1/25/16
to django-...@googlegroups.com
#24919: Add an option not to run migrations when running tests
-----------------------------+---------------------------------------------
Reporter: kairichard | Owner: andrewgodwin
Type: New feature | Status: closed
Component: Migrations | Version: master
Severity: Normal | Resolution: fixed
Keywords: 1.9 | Triage Stage: Ready for checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

Comment (by Simon Charette <charette.s@…>):

In [changeset:"abdbf00815ae8f49247082528d02a3d0890785a9" abdbf00]:
{{{
#!CommitTicketReference repository=""
revision="abdbf00815ae8f49247082528d02a3d0890785a9"
[1.9.x] Fixed #26135 -- Adjusted the migration questioner's handling of
disabled apps.

This was causing an issue when calling the `migrate` command in a test
case with
the `available_apps` attribute pointing to an application with migrations
disabled using the `MIGRATION_MODULES` setting.

Thanks to Tim Graham for the review.

Refs #24919

Backport of 4dcaa5871b70859952c6f9c437dfe1b5f10509f2 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24919#comment:18>

Django

unread,
Jan 25, 2016, 10:54:50 PM1/25/16
to django-...@googlegroups.com
#24919: Add an option not to run migrations when running tests
-----------------------------+---------------------------------------------
Reporter: kairichard | Owner: andrewgodwin
Type: New feature | Status: closed
Component: Migrations | Version: master
Severity: Normal | Resolution: fixed
Keywords: 1.9 | Triage Stage: Ready for checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

Comment (by Simon Charette <charette.s@…>):

In [changeset:"645fddcd4ee6adaa619b90404b85ccc8d9c316d8" 645fddcd]:
{{{
#!CommitTicketReference repository=""
revision="645fddcd4ee6adaa619b90404b85ccc8d9c316d8"
[1.9.x] Refs #24919 -- Used the documented way of disabling migrations per
app.

Backport of 477274acb46b2f07666e9f84dea2e65ea6b63ad3 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24919#comment:19>

Reply all
Reply to author
Forward
0 new messages