How do I use PyMock and Nose with Django models?

I'm trying to do TDD with PyMock, but I keep getting the error when I use Nose and run core.py from the command line:

"ERROR: Failure: ImportError (Parameters cannot be imported because the DJA environment variable NGO_SETTINGS_MODULE is undefined.)"

If I remove "from insert cms.models import" from the unit test module I created, everything works fine, but I need to mock the functionality in the django cms.models.Entry module that I created.

What am I doing wrong? It can be done?

+2


source to share


1 answer


You do need to DJANGO_SETTINGS_MODULE

be defined to run core.py

- why don't you just run export DJANGO_SETTINGS_MODULE=whatever

your bash session before running nose?



+4


source







All Articles