Mongo - testing

24 views
Skip to first unread message

xy zz

unread,
Oct 3, 2010, 10:44:07 AM10/3/10
to Django users
Hello,

A couple of questions regarding nosql. I am interested in MongoDB in
particular, but general answers are also ok.

* Is there any work going on in Django to support nosql databases? I
am aware of django-nonrel but will nosql support be a part of Django
core or contrib sometime? If yes, what is the expected time frame?

* Since there is no support for nosql right now, how are we supposed
to write tests? I am working on a project which uses pymongo to
connect to MongoDB. However, the tests don't work, since Django is
not able to create a test database. What is the recommended way to
solve this problem? I have googled a bit and seen solutions like -
http://www.valyagolev.net/article/mon_django_growing/. However, I
don't want to go down this path since it seems to me that solutions
like this are copying core functionalities and editing it to suit the
need. I would think this would make getting changes from upsteam
(Django core) more difficult. I am currently thinking that I will
have a script to run the tests - so I can't do

$ python manage.py test cms but instead

$ python runserver.py cms

Does this sound reasonable or am I missing something.

xy zz

unread,
Oct 3, 2010, 11:54:15 AM10/3/10
to Django users
>
> $ python runserver.py cms

Oops - I meant

$ python runtests.py cms

Russell Keith-Magee

unread,
Oct 3, 2010, 7:20:14 PM10/3/10
to django...@googlegroups.com
On Sun, Oct 3, 2010 at 10:44 PM, xy zz <xyz...@gmail.com> wrote:
> Hello,
>
> A couple of questions regarding nosql.  I am interested in MongoDB in
> particular, but general answers are also ok.
>
> * Is there any work going on in Django to support nosql databases?  I
> am aware of django-nonrel but will nosql support be a part of Django
> core or contrib sometime?  If yes, what is the expected time frame?

We hosted a Summer of Code project this year that was aiming to put
the infrastructure in place to make support for NoSQL data stores
possible. This work is being roughly targetted at the 1.4 release of
Django, (ETA Q3 2011).

If you have expertise in Mongo and want to help out, there is a recent
thread on django-developers describing the state of play of this work.

> * Since there is no support for nosql right now, how are we supposed
> to write tests?  I am working on a project which uses pymongo to
> connect to MongoDB.  However, the tests don't work, since Django is
> not able to create a test database.  What is the recommended way to
> solve this problem?  I have googled a bit and seen solutions like -
> http://www.valyagolev.net/article/mon_django_growing/.  However, I
> don't want to go down this path since it seems to me that solutions
> like this are copying core functionalities and editing it to suit the
> need.  I would think this would make getting changes from upsteam
> (Django core) more difficult.  I am currently thinking that I will
> have a script to run the tests - so I can't do
>
> $ python manage.py test cms but instead
>
> $ python runserver.py cms

Well... you can call runtests; you just need to handle your own
testing infrastructure. I haven't used MongoDB (or any other noSQL
store) enough to be able to make any concrete suggestions, but I would
suggest that you're going to need to either install a mock, or work
out a scheme for creating a test database in the same way that Django
handles the test SQL database. Django's test framework provides the
hooks to do this if you can work out what you need to do.

Yours,
Russ Magee %-)

xy zz

unread,
Oct 3, 2010, 9:59:05 PM10/3/10
to Django users
On Oct 4, 4:20 am, Russell Keith-Magee <russ...@keith-magee.com>
wrote:

> Well... you can call runtests; you just need to handle your own
> testing infrastructure. I haven't used MongoDB (or any other noSQL
> store) enough to be able to make any concrete suggestions, but I would
> suggest that you're going to need to either install a mock, or work
> out a scheme for creating a test database in the same way that Django
> handles the test SQL database. Django's test framework provides the
> hooks to do this if you can work out what you need to do.
>
Thanks Russell, for your comments. I have joined the developers list.

Is there any advantage/reason for creating/dropping test database when
we run manage.py? The solution I had proposed doesn't attempt this
and instead relies on the user to make sure the test database is
accessible.

Also, can you please give a url or some pointers to the hooks provided
by Django to create test database?

Thanks.

Reply all
Reply to author
Forward
0 new messages