python - Basic Tests in Django -


i making test in django project, when execute test in console following output

(course)bgarcial@el-pug:~/python_devel/course/proyecto_clase2$ python manage.py test app creating test database alias 'default'... e ====================================================================== error: proyecto_clase2.app.tests (unittest.loader.moduleimportfailure) ---------------------------------------------------------------------- importerror: failed import test module: proyecto_clase2.app.tests traceback (most recent call last):   file "/usr/lib/python2.7/unittest/loader.py", line 252, in _find_tests      module = self._get_module_from_name(name)   file "/usr/lib/python2.7/unittest/loader.py", line 230, in _get_module_from_name       __import__(name)  importerror: no module named app.tests    ----------------------------------------------------------------------  ran 1 test in 0.000s   failed (errors=1)  destroying test database alias 'default'... (course)bgarcial@el-pug:~/python_devel/course/proyecto_clase2$ 

my file tests.py following:

from django.test import testcase  .models import categoria,enlace django.contrib.auth.models import user  # create tests here.      class simpletest(testcase):         def test_es_popular(self):              categoria = categoria.objects.create(titulo='categoria de prueba')              usuario = user.objects.create_user(username='julian', password='barbas')             enlace.objects.create(titulo='prueba',enlace='http://ieee-wie.co', votos=0,                               categoria=categoria, usuario=usuario) 

what thing can happenning in relation module has been failed?

i had similar problem , able solve using answer this question. test runner trying import tests project directory rather module part of.

try running single test explicitly with:

$ python manage.py test app.tests.simpletest 

then try removing __init__.py file project directory if have 1 there (the directory under manage.py file stored not directory settings stored).


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -