Thursday, October 2, 2014

Unable to import 3 modules when running tests

I'm doing python manage.py test, but always receive one of the following ImportError messages.

ImportError: No module named 'expressions_regress'  ImportError: No module named 'aggregation'  ImportError: No module named 'migrations'

I have ensured my virtual environment is enabled. I'm on Django 1.7.

Here is my settings.py

"""  Django settings for app project.    For more information on this file, see  https://docs.djangoproject.com/en/1.7/topics/settings/    For the full list of settings and their values, see  https://docs.djangoproject.com/en/1.7/ref/settings/  """    # Build paths inside the project like this: os.path.join(BASE_DIR, ...)  import os  BASE_DIR = os.path.dirname(os.path.dirname(__file__))      # Quick-start development settings - unsuitable for production  # See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/    # SECURITY WARNING: keep the secret key used in production secret!  SECRET_KEY = 'SECRET_KEY'    # SECURITY WARNING: don't run with debug turned on in production!  DEBUG = True    TEMPLATE_DEBUG = True    ALLOWED_HOSTS = ['127.0.0.1']      # Application definition    INSTALLED_APPS = (      'django.contrib.admin',      'django.contrib.auth',      'django.contrib.contenttypes',      'django.contrib.sessions',      'django.contrib.messages',      'django.contrib.staticfiles',      'rest_framework',      'base',      'api'  )    MIDDLEWARE_CLASSES = (      'django.contrib.sessions.middleware.SessionMiddleware',      'django.middleware.common.CommonMiddleware',      'django.middleware.csrf.CsrfViewMiddleware',      'django.contrib.auth.middleware.AuthenticationMiddleware',      'django.contrib.auth.middleware.SessionAuthenticationMiddleware',      'django.contrib.messages.middleware.MessageMiddleware',      'django.middleware.clickjacking.XFrameOptionsMiddleware',  )    ROOT_URLCONF = 'app.urls'    WSGI_APPLICATION = 'app.wsgi.application'      # Database  # https://docs.djangoproject.com/en/1.7/ref/settings/#databases    DATABASES = {      'default': {          'NAME': 'DB_NAME',          'ENGINE': 'sqlserver_ado',          'HOST': 'DB_HOST',          'USER': ''      }  }    # Internationalization  # https://docs.djangoproject.com/en/1.7/topics/i18n/    LANGUAGE_CODE = 'en-us'    TIME_ZONE = 'UTC'    USE_I18N = True    USE_L10N = True    USE_TZ = True      # Static files (CSS, JavaScript, Images)  # https://docs.djangoproject.com/en/1.7/howto/static-files/    STATIC_URL = '/static/'    REST_FRAMEWORK = {      'PAGINATE_BY': 10,      'PAGINATE_BY_PARAM': 'page_size',      'MAX_PAGINATE_BY': 100  }

Full traceback -

$ python manage.py test  Traceback (most recent call last):    File "manage.py", line 10, in <module>      execute_from_command_line(sys.argv)    File "c:\Python34\lib\site-packages\django\core\management\__init__.py", line 385, in execute_from_command_line      utility.execute()    File "c:\Python34\lib\site-packages\django\core\management\__init__.py", line 377, in execute      self.fetch_command(subcommand).run_from_argv(self.argv)    File "c:\Python34\lib\site-packages\django\core\management\commands\test.py", line 50, in run_from_argv      super(Command, self).run_from_argv(argv)    File "c:\Python34\lib\site-packages\django\core\management\base.py", line 288, in run_from_argv      self.execute(*args, **options.__dict__)    File "c:\Python34\lib\site-packages\django\core\management\commands\test.py", line 71, in execute      super(Command, self).execute(*args, **options)    File "c:\Python34\lib\site-packages\django\core\management\base.py", line 338, in execute      output = self.handle(*args, **options)    File "c:\Python34\lib\site-packages\django\core\management\commands\test.py", line 88, in handle      failures = test_runner.run_tests(test_labels)    File "c:\Python34\lib\site-packages\django\test\runner.py", line 147, in run_tests      old_config = self.setup_databases()    File "c:\Python34\lib\site-packages\django\test\runner.py", line 109, in setup_databases      return setup_databases(self.verbosity, self.interactive, **kwargs)    File "c:\Python34\lib\site-packages\django\test\runner.py", line 299, in setup_databases      serialize=connection.settings_dict.get("TEST_SERIALIZE", True),    File "c:\Python34\lib\site-packages\sqlserver_ado\creation.py", line 126, in create_test_db      self.mark_tests_as_expected_failure(self.connection.features.failing_tests)    File "c:\Python34\lib\site-packages\sqlserver_ado\creation.py", line 120, in mark_tests_as_expected_failure      test_case = import_string(test_case_name)    File "c:\Python34\lib\site-packages\django\utils\module_loading.py", line 26, in import_string      module = import_module(module_path)    File "c:\Python34\lib\importlib\__init__.py", line 109, in import_module      return _bootstrap._gcd_import(name[level:], package, level)    File "<frozen importlib._bootstrap>", line 2254, in _gcd_import    File "<frozen importlib._bootstrap>", line 2237, in _find_and_load    File "<frozen importlib._bootstrap>", line 2212, in _find_and_load_unlocked    File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed    File "<frozen importlib._bootstrap>", line 2254, in _gcd_import    File "<frozen importlib._bootstrap>", line 2237, in _find_and_load    File "<frozen importlib._bootstrap>", line 2224, in _find_and_load_unlocked  ImportError: No module named 'expressions_regress'

Also, for some strange reason Googling all 3 errors I'm getting yields nothing of value.

How can I resolve this?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0b4a4550-e850-46ec-b301-b92f9975beeb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment