I'm trying to do TDD with PyMock, but I keep getting error when I use Nose and execute core.py from command line:
"ERROR: Failure: ImportError (Settings cannot be imported, because environment variable DJA NGO_SETTINGS_MODULE is undefined.)"
If I remove "from cms.models import Entry" from the unit test module I created, everything works fine, but I need to mock functionality in django module cms.models.Entry that I created.
What am I doing wrong? Can this be done?
You do need DJANGO_SETTINGS_MODULE
defined in order to run core.py
-- why don't you just export DJANGO_SETTINGS_MODULE=whatever
in your bash session before starting nose?
来源:https://stackoverflow.com/questions/1484293/how-do-i-use-pymock-and-nose-with-django-models