+3  A: 

It looks like Mercurial's way of importing modules is clashing with Django's somehow.

Before trying to dive in and sort that out, is there any reason to not just run the tests with the normal command?

[hooks]
precommit.runtests = python manage.py test
Steve Losh
will it return status 1 when the tests fail?
Jiaaro
answer: yes it does! :) thanks
Jiaaro
Actually it will return the number of tests that failed as the return code -- ex: 3 failed tests -> return code == 3, all tests passed -> return code 0. So yeah, it will work as a hook.
Steve Losh
or just disable demandimport globally (in hg), or find the offending module and blacklist it.
tonfa