Reputation: 24774
with django 1.6, I have a django app with tests.py file
app
- tests.py
in this file I tested some management functions
from management.commands.getevents import some_function
when I try change the tests.py to a tests directory with differents tests files
app
- tests
-- __init__.py
-- test_models.py
-- test_views.py
-- test_managements.py
and I try running the test
python manage.py test
get this error
ImportError: Failed to import test module: events.tests.test_managements
...
ImportError: No module named management.commands...
with the directory of test files, why django don't see the management module ?
Upvotes: 1
Views: 346
Reputation: 474081
Explicitly import management
from app
:
from app.management.commands.getevents import some_function
Just to prove my words with a working example, check how custom management command is imported in django-compressor
tests:
from compressor.management.commands.compress import Command as CompressCommand
Upvotes: 2