2

I have the following project structure with Django 1.6:

DjangoMain
    - app_1
        - __init__.py
        - models.py
        - views.py
        - urls.py
        - test_views.py

If I run the following command my tests are processed without any issue by Django:

- python manage.py test app_1.test_views
Creating test database for alias 'default'...
.......
----------------------------------------------------------------------
Ran 7 tests in 1.436s

OK

But, when I want to run all my test in all my app using the global test command (without specifying an app) I have the following error:

- python manage.py test app_1
======================================================================
ERROR: DjangoMain.app_1.test_views (unittest.loader.ModuleImportFailure)
----------------------------------------------------------------------
ImportError: Failed to import test module: DjangoMain.app_1.test_views
Traceback (most recent call last):
File        "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/loader.py", line 252, in _find_tests
module = self._get_module_from_name(name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/loader.py", line 230, in _get_module_from_name
__import__(name) 
ImportError: No module named app_1.test_views

Has anyone an idea of what's going on with my project? It seems django is not able to find by himself the different tests to run. And I have absolutely no idea why.

Alex Grs
  • 3,231
  • 5
  • 39
  • 58

0 Answers0