Speeding up test database creation

35 views
Skip to first unread message

Andres Reyes Monge

unread,
Nov 26, 2012, 8:56:30 AM11/26/12
to django...@googlegroups.com
The tutorial uses a sqlite file database not a in memory database, try omitting the name parameter and it should speed things up

John Maxwell

unread,
Nov 27, 2012, 4:43:37 PM11/27/12
to django...@googlegroups.com
Hm, I tried commenting out the line

'NAME': '/home/john/database.sqlite',

and it still seems to be just as slow, if not slower...
Message has been deleted

John Maxwell

unread,
Nov 27, 2012, 9:11:37 PM11/27/12
to django...@googlegroups.com
I just tried changing 'NAME' to ':memory:' and I'm still getting the same results.

I continued with the tutorial for a while, and it turns out that the unit tests for the polls app don't have this problem.  So now I'm beginning to suspect that there's a problem with Django, and the implementation of LiveServerTestCase doesn't do the usual in-memory database magic (this may even be by design, though I can't think of any good reasons offhand).

The Selenium-based testing is not proving as useful as the tutorial sells it, either...  When I use the find_by_name method of the browser object, and the relevant name isn't to be found, it seems to hang indefinitely instead of stopping and alerting me of the problem.  So combining these two considerations, perhaps it's best to stick to unit tests and not bother with functional tests.

On Tue, Nov 27, 2012 at 3:39 PM, Dennis Lee Bieber <wlf...@ix.netcom.com> wrote:
On Tue, 27 Nov 2012 13:43:37 -0800 (PST), John Maxwell
<notif...@gmail.com> declaimed the following in
gmane.comp.python.django.user:
        I suspect the best version would be to change the NAME into the
specific string SQLite3 uses for memory -- ":memory:" (though using ""
supposedly does the same, and may be what the previous respondent meant)
--
        Wulfraed                 Dennis Lee Bieber         AF6VN
        wlf...@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.


Reply all
Reply to author
Forward
0 new messages