I am trying to set up unit tests on my project
but when I try to import anything from f.e. django.test
then I get this error:
Traceback (most recent call last):
  File 
"C:\eclipse\plugins\org.python.pydev.debug_2.2.2.2011082312\pysrc\pydev_runfiles.py",
 
line 307, in __get_module_from_str
    mod = __import__(modname)
  File "C:/TFSSrc_Branch/DER_UnitTesting/bo/tests/testLists\Test.py", line 
8, in <module>
    from django.test.Client import Client
  File "C:\TFSSrc_Branch\DER_UnitTesting\django\test\__init__.py", line 6, 
in <module>
    from django.test.testcases import TestCase
  File "C:\TFSSrc_Branch\DER_UnitTesting\django\test\testcases.py", line 
10, in <module>
    from django.db import transaction
  File "C:\TFSSrc_Branch\DER_UnitTesting\django\db\__init__.py", line 9, in 
<module>
    if not settings.DATABASE_ENGINE:
  File "C:\TFSSrc_Branch\DER_UnitTesting\django\conf\__init__.py", line 28, 
in __getattr__
    self._import_settings()
  File "C:\TFSSrc_Branch\DER_UnitTesting\django\conf\__init__.py", line 59, 
in _import_settings
    self._target = Settings(settings_module)
  File "C:\TFSSrc_Branch\DER_UnitTesting\django\conf\__init__.py", line 94, 
in __init__
    raise ImportError, "Could not import settings '%s' (Is it on sys.path? 
Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e)
ImportError: Could not import settings 'DER.settings' (Is it on sys.path? 
Does it have syntax errors?): No module named DER.settings
ERROR: Module: Test could not be imported (file: 
C:\TFSSrc_Branch\DER_UnitTesting\bo\tests\testLists\Test.py).

Here is my code:
import unittest
#from django.utils import unittest
from django.test.Client import Client

class TestLists(unittest.TestCase):

    def setUp(self):
        from django.test import Client
        self.client =  Client()
        self.client.login(username='erlendurh', password='e12345')

    def tearDown(self):
        pass

    def testGetList(self):
        
self.client.get('/clearing/rep/contracts/from/2011-11-16/to/2011-11-26/')
        
if __name__ == "__main__":
    unittest.main()

I would be very glad if someone could help me with this problem :)

Best regards
Erlendur

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Uqka7hRGThwJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to