Reputation: 5438
Traceback:
./manage.py test my_app
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/zuber/projects/private-CR/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/home/zuber/projects/private-CR/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/zuber/projects/private-CR/env/local/lib/python2.7/site-packages/django/core/management/commands/test.py", line 30, in run_from_argv
super(Command, self).run_from_argv(argv)
File "/home/zuber/projects/private-CR/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 381, in run_from_argv
parser = self.create_parser(argv[0], argv[1])
File "/home/zuber/projects/private-CR/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 354, in create_parser
self.add_arguments(parser)
File "/home/zuber/projects/private-CR/env/local/lib/python2.7/site-packages/django/core/management/commands/test.py", line 52, in add_arguments
test_runner_class = get_runner(settings, self.test_runner)
File "/home/zuber/projects/private-CR/env/local/lib/python2.7/site-packages/django/test/utils.py", line 152, in get_runner
test_module = __import__(test_module_name, {}, {}, force_str(test_path[-1]))
ImportError: No module named simple
I tried to remove init.py from app folder and then I've got "No module named app_name". When I removed init.py from project folder - console said "No module named settings". How to test my app?
Upvotes: 2
Views: 4056
Reputation: 10111
For me while using Pycharm the problem was that the PyCharm test runner was not compatible with Django 2.0
The solution was: replace line 254:EOF with
if VERSION[1] > 1 or VERSION[0] > 1:
return DjangoTeamcityTestRunner(**options).run_tests(test_labels,
extra_tests=extra_tests, **options)
return run_the_old_way(extra_tests, options, test_labels, verbosity)
Instead of:
if VERSION[1] > 1:
return DjangoTeamcityTestRunner(**options).run_tests(test_labels,
extra_tests=extra_tests, **options)
return run_the_old_way(extra_tests, options, test_labels, verbosity)
Upvotes: 0
Reputation: 5438
I resolved the problem by removing
TEST_RUNNER = 'django.test.simple.DjangoTestSuiteRunner'
from settings.py
see related question running all tests post django 1.6
Upvotes: 1
Reputation: 10090
So first of all, you need to put your two __init__.py
s back where you found them. They are what allow you to import things from that module. Secondly, you should post the code in manage.py
so we have a better idea of what is going on, but it looks to me like you had a line in there that looks something like import django.contrib.admin.util
or import <something> from django.contrib.admin.util
. This module was removed in the release of django that you're using, so you should replace any occurrances of django.contrib.admin.util
with django.contrib.admin.utils
.
Upvotes: 3