Tuesday, November 27, 2012

Re: Speeding up test database creation

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 <wlfraed@ix.netcom.com> wrote:
On Tue, 27 Nov 2012 13:43:37 -0800 (PST), John Maxwell
<notifyjohn@gmail.com> declaimed the following in
gmane.comp.python.django.user:

> Hm, I tried commenting out the line
>
> 'NAME': '/home/john/database.sqlite',
>
> and it still seems to be just as slow, if not slower...
>
> On Monday, November 26, 2012 5:56:30 AM UTC-8, Andres Reyes Monge wrote:
> >
> > The tutorial uses a sqlite file database not a in memory database, try
> > omitting the name parameter and it should speed things up

        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
        wlfraed@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-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.


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

No comments:

Post a Comment