Trouble running tests
I'm sure this has something to do with some configuration, but I'm having trouble running a basic django test in pycharm.
If, from inside the root of my project, I run: python3 managepy test, my tests run fine.
If, however, I try to run my tests by using Tools|Run Manage.py task, I get this:
App registry isn't ready yet.…
/usr/local/bin/python3}/Applications/PyCharm.app/helpers/pycharm/django_test_manage.py test /Users/mrankin/src/tddproject/superlists
Testing started at 8:19 AM ...
Traceback (most recent call last):
File "/Applications/PyCharm.app/helpers/pycharm/django_test_manage.py", line 124, in <module>
utility.execute()
File "/Applications/PyCharm.app/helpers/pycharm/django_test_manage.py", line 99, in execute
PycharmTestCommand().run_from_argv(self.argv)
File "/usr/local/lib/python3.3/site-packages/django/core/management/commands/test.py", line 50, in run_from_argv
super(Command, self).run_from_argv(argv)
File "/usr/local/lib/python3.3/site-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/local/lib/python3.3/site-packages/django/core/management/commands/test.py", line 71, in execute
super(Command, self).execute(*args, **options)
File "/usr/local/lib/python3.3/site-packages/django/core/management/base.py", line 330, in execute
translation.activate('en-us')
File "/usr/local/lib/python3.3/site-packages/django/utils/translation/__init__.py", line 144, in activate
File "/usr/local/lib/python3.3/site-packages/django/utils/translation/trans_real.py", line 217, in activate
_active.value = translation(language)
File "/usr/local/lib/python3.3/site-packages/django/utils/translation/trans_real.py", line 201, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "/usr/local/lib/python3.3/site-packages/django/utils/translation/trans_real.py", line 184, in _fetch
for app_config in reversed(list(apps.get_app_configs())):
File "/usr/local/lib/python3.3/site-packages/django/apps/registry.py", line 125, in get_app_configs
self.check_ready()
File "/usr/local/lib/python3.3/site-packages/django/apps/registry.py", line 119, in check_ready
raise RuntimeError("App registry isn't ready yet.")
RuntimeError: App registry isn't ready yet.
Process finished with exit code 1
If I run the command that pycharm tried to run:
/usr/local/bin/python3 /Applications/PyCharm.app/helpers/pycharm/django_test_manage.py test /Users/mrankin/src/tddproject/superlists
, I get this:
Requested setting TEST_RUNNER, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.…
Traceback (most recent call last):
File "/Applications/PyCharm.app/helpers/pycharm/django_test_manage.py", line 18, in <module>
import django_test_runner
File "/Applications/PyCharm.app/helpers/pycharm/django_test_runner.py", line 10, in <module>
if hasattr(settings, "TEST_RUNNER") and "NoseTestSuiteRunner" in settings.TEST_RUNNER:
File "/usr/local/lib/python3.3/site-packages/django/conf/__init__.py", line 46, in __getattr__
self._setup(name)
File "/usr/local/lib/python3.3/site-packages/django/conf/__init__.py", line 40, in _setup
% (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting TEST_RUNNER, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
I've tried a bunch of setting changes, but I feel like I'm just guessing at this point.
If, from inside the root of my project, I run: python3 managepy test, my tests run fine.
If, however, I try to run my tests by using Tools|Run Manage.py task, I get this:
App registry isn't ready yet.…
/usr/local/bin/python3}/Applications/PyCharm.app/helpers/pycharm/django_test_manage.py test /Users/mrankin/src/tddproject/superlists
Testing started at 8:19 AM ...
Traceback (most recent call last):
File "/Applications/PyCharm.app/helpers/pycharm/django_test_manage.py", line 124, in <module>
utility.execute()
File "/Applications/PyCharm.app/helpers/pycharm/django_test_manage.py", line 99, in execute
PycharmTestCommand().run_from_argv(self.argv)
File "/usr/local/lib/python3.3/site-packages/django/core/management/commands/test.py", line 50, in run_from_argv
super(Command, self).run_from_argv(argv)
File "/usr/local/lib/python3.3/site-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/local/lib/python3.3/site-packages/django/core/management/commands/test.py", line 71, in execute
super(Command, self).execute(*args, **options)
File "/usr/local/lib/python3.3/site-packages/django/core/management/base.py", line 330, in execute
translation.activate('en-us')
File "/usr/local/lib/python3.3/site-packages/django/utils/translation/__init__.py", line 144, in activate
return _trans.activate(language)
_active.value = translation(language)
File "/usr/local/lib/python3.3/site-packages/django/utils/translation/trans_real.py", line 201, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "/usr/local/lib/python3.3/site-packages/django/utils/translation/trans_real.py", line 184, in _fetch
for app_config in reversed(list(apps.get_app_configs())):
File "/usr/local/lib/python3.3/site-packages/django/apps/registry.py", line 125, in get_app_configs
self.check_ready()
File "/usr/local/lib/python3.3/site-packages/django/apps/registry.py", line 119, in check_ready
raise RuntimeError("App registry isn't ready yet.")
RuntimeError: App registry isn't ready yet.
Process finished with exit code 1
If I run the command that pycharm tried to run:
/usr/local/bin/python3 /Applications/PyCharm.app/helpers/pycharm/django_test_manage.py test /Users/mrankin/src/tddproject/superlists
, I get this:
Requested setting TEST_RUNNER, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.…
Traceback (most recent call last):
File "/Applications/PyCharm.app/helpers/pycharm/django_test_manage.py", line 18, in <module>
import django_test_runner
File "/Applications/PyCharm.app/helpers/pycharm/django_test_runner.py", line 10, in <module>
if hasattr(settings, "TEST_RUNNER") and "NoseTestSuiteRunner" in settings.TEST_RUNNER:
File "/usr/local/lib/python3.3/site-packages/django/conf/__init__.py", line 46, in __getattr__
self._setup(name)
File "/usr/local/lib/python3.3/site-packages/django/conf/__init__.py", line 40, in _setup
% (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting TEST_RUNNER, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
I've tried a bunch of setting changes, but I feel like I'm just guessing at this point.
Please sign in to leave a comment.