Hi, I am trying to run a unit test for my models. My unit test is as follows
import os import unittest from myproject import models DJANGO_PATH = "DJANGO_SETTINGS_MODULE" os.environ[DJANGO_PATH] = "myproject.settings" class ModelsTestCase(unittest.TestCase): user = None def setUp(self): self.user = models.User.create(first_name='Krishnan', last_name='Karthik') def testUserInstantiation(self): self.failIfEqual(self.user, None, "Failure to initialize") I always get this error: line 57, in _import_settings raise ImportError("Settings cannot be imported, because environment variable %s is undefined." % ENVIRONMENT_VARIABLE) ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined. This is inspite of the setting the environment settings on top of the test case. Please let me know if i am doing anything wrong. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---