Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

django-nose and south, but don't test migrations!

59 views
Skip to first unread message

Peter Bengtsson

unread,
Jan 20, 2015, 12:58:54 PM1/20/15
to dev-webdev
Every since I added `south` to INSTALLED_APPS (the webapp in Socorro [0])
Running the whole test suite has gone from ~5 seconds to ~50 seconds and I
can't figure out how to tell south to NOT get involved. Basically, I trust
what syncdb sets up.

For what it's worth, I'm using test-utils to force the DATABASES to be a
`:memory:` sqlite thing. And so, I always have `FORCE_DB=true` on.

Things that DON'T work:

* Setting `SOUTH_TESTS_MIGRATE=False` (I think this only applies if you
don't use django-nose)

* Prefixing with `REUSE_DB=1` on the command line

Things that DOES work:

* Removing 'south' from INSTALLED_APPS before running the tests. Not a very
practical solution because I'll want it in there when making migrations and
running them.


I'm happy to dig deeper and file issues and stuff but perhaps this is a
known issue that's been solved by you before.


[0] https://github.com/mozilla/socorro/pull/2581

--
Peter Bengtsson
Mozilla Web Engineering

Peter Bengtsson

unread,
Jan 20, 2015, 1:06:39 PM1/20/15
to dev-webdev
For what it's worth, I'm using test-utils so the TEST_RUNNER is set to
test_utils.runner.RadicalTestSuiteRunner

On Tue, Jan 20, 2015 at 9:58 AM, Peter Bengtsson <pbeng...@mozilla.com>
wrote:

Peter Bengtsson

unread,
Jan 20, 2015, 1:35:15 PM1/20/15
to dev-webdev
Seems I was wrong SOUTH_TESTS_MIGRATE mattering. Sort of.
If you set SOUTH_TESTS_MIGRATE=False in your settings, the `syncdb` command
becomes `django.core.management.commands.syncdb`.
However, it still takes ~50 seconds to run the tests when `south` is
installed.

On Tue, Jan 20, 2015 at 10:06 AM, Peter Bengtsson <pbeng...@mozilla.com>

Michael Cooper

unread,
Jan 20, 2015, 1:46:16 PM1/20/15
to Peter Bengtsson, dev-webdev
SUMO also uses south and I think we are using the RadicalTestSuiteRunner as
well. When I just run the tests, the migrations are also run (one of our
migrations prints something, so it's easy to tell).

Adding the environment variables FORCE_DB=0 REUSE_DB=1 makes the migrations
not run for me. Both are required. One is for south, the other is for
test-utils. For me, this speeds our tests up by about 40 seconds. This is
on top of SOUTH_TESTS_MIGRATE=False.
> _______________________________________________
> dev-webdev mailing list
> dev-w...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-webdev
>

Michael Cooper

unread,
Jan 20, 2015, 1:48:00 PM1/20/15
to Peter Bengtsson, dev-webdev
Correction: Those two environment variables (together) cause the system to
re-use old test databases, which is often ok. If the database needs to be
created (because it was deleted, for example), the migrations are still run.

On Tue, Jan 20, 2015 at 10:45 AM, Michael Cooper <mco...@mozilla.com>
wrote:

Peter Bengtsson

unread,
Jan 20, 2015, 2:33:58 PM1/20/15
to Michael Cooper, dev-webdev
Something's being very very odd here.

So, I install nose-timer and run the tests with and without south...:

I ran the tests with `south` in INSTALLED_APPS and
`SOUTH_TESTS_MIGRATE=False` set:
https://gist.github.com/peterbe/9202c20edee964a370d3

Then I removed `south` from INSTALLED_APPS and ran it again:
https://gist.github.com/peterbe/34c9b14028d63429491c

As you can see, having `south` installed (even though its syncdb isn't
used) is 47.574s instead of 5.394s.

It's 40+ seconds difference and that difference is spread across every test!

I can't use FORCE_DB=0 REUSE_DB=1 because I'm using a sqlite :memory:
database.


On Tue, Jan 20, 2015 at 10:47 AM, Michael Cooper <mco...@mozilla.com>

Peter Bengtsson

unread,
Jan 20, 2015, 3:39:11 PM1/20/15
to Michael Cooper, dev-webdev
I'm hoping someone on the Django-users mailing list has some ideas:
https://groups.google.com/d/msg/django-users/rSzl_rSw-WM/Ibre-3LzkxQJ

I guess I'll continue my blathering (aka. hair-tearing) there.

On Tue, Jan 20, 2015 at 11:33 AM, Peter Bengtsson <pbeng...@mozilla.com>
0 new messages