Hi Folks,

I've been working on speeding up a django-1.7 applications unit tests to
encourage developers to write more of them. Currently, django's strategy
for ensuring that its database is fresh for each test run is to create a
new test database and run all of the migrations on it. I've noticed that
the bulk of the time is spent on spinning up the test database. This was
also the case in a previous project that I worked on that ran django-1.4.

I recently had an idea: why not, after running the migrations on the
newly-spun-up database, store a representation of that database somewhere
that could be more quickly loaded? I suspect this would be particularly
useful for an in-memory test database like sqlite, especially if someone
was using a tool likewatchdog <https://pythonhosted.org/watchdog/> to
automatically run their tests each time they changed one of their
applications' files. This cache could be accompanied by a hash of all of
the migrations that needed to be run and would only need to change when one
of the applications listed in settings.INSTALLED_APPS had a change to its
migrations.

This is of course going to be running up against one of the 2 hard things
in computer science: cache invalidation. So, I wanted to get y'alls
opinions on whether this was worth attempting.

cheers,
Andrew

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CA%2By5TLaBPLg%2Bg-Cuft%2B1e5w19bCxA-Mfq3EQE6mChLoNYfd6RA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to