
Do you train Kung Fu?
Or know someone who does?
Then check out KungFuPeople.com
Mobile version of this pageMuted conversations in Gmail
Next:
TfL Traffic cameras on a Google map
Related blogs
Mocking a Python standard libraryDjango vs. Java
To assert or assertEqual in Python unit testing
setuptools usability - not good, what can be done?
gorun.py - Using (py)inotify to run commands when files change
EditDistanceMatcher - NodeJS script for doing edit distance 1 matching
Speed test between django_mongokit and postgresql_psycopg2
mongoengine vs. django-mongokit
How I made my MongoDB based web app 10 times faster
Mocking DBRefs in Mongoose and nodeunit
Optimization story involving something silly I call "dict+"
Persistent caching with fire-and-forget updates
Related by category

Correction: running Django tests with MongoDB is NOT slow
30th of May 2010
At Euro DjangoCon I met lots of people and talked a lot about MongoDB as the backend. I even did a presentation on the subject which led to a lot of people asking me more questions about MongoDB.
I did mention to some people that one of the drawbacks of using MongoDB which doesn't have transactions is that you have to create and destroy the collections (like SQL tables) each time for every single test runs. I thought this was slow. It's not
Today I've been doing some more profiling and testing and debugging and I can conclude that it's not a problem. Creating the database has a slight delay but it's something you only have to do once and actually it's very fast. Here's how I tear down the collections in between each test:
def tearDown(self):
for name in self.database.collection_names():
if name not in ('system.indexes',):
self.database.drop_collection(name)
For example, running test of one of my apps looks like this:
...........lots.............
----------------------------------------------------------------------
Ran 55 tests in 3.024s
So, don't fear writing lots of individual unit tests. MongoDB will not slow you down.

