estebistec / drf-compound-fields

Django-REST-framework serializer fields for compound types.
BSD 3-Clause "New" or "Revised" License
92 stars 12 forks source link

Test setup error #17

Closed expobrain closed 10 years ago

expobrain commented 10 years ago

Following the instructions of how to setup a developer's environment and running the unit tests raises this error on python setup.py test:

_____ ERROR collecting djangorestframework-2.3.14-py2.7.egg/rest_framework/tests/test_authentication.py __ djangorestframework-2.3.14-py2.7.egg/rest_framework/tests/test_authentication.py:2: in

from django.contrib.auth.models import User ../../.virtualenvs/drf_compound_fields/lib/python2.7/site-packages/django/contrib/auth/init.py:6: in from django.middleware.csrf import rotate_token ../../.virtualenvs/drf_compound_fields/lib/python2.7/site-packages/django/middleware/csrf.py:14: in from django.utils.cache import patch_vary_headers ../../.virtualenvs/drf_compound_fields/lib/python2.7/site-packages/django/utils/cache.py:26: in from django.core.cache import get_cache ../../.virtualenvs/drf_compound_fields/lib/python2.7/site-packages/django/core/cache/init.py:69: in if DEFAULT_CACHE_ALIAS not in settings.CACHES: ../../.virtualenvs/drf_compound_fields/lib/python2.7/site-packages/django/conf/init.py:54: in getattr self._setup(name) ../../.virtualenvs/drf_compound_fields/lib/python2.7/site-packages/django/conf/init.py:47: in _setup % (desc, ENVIRONMENT_VARIABLE)) E ImproperlyConfigured: Requested setting CACHES, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

I'm not sure if it's some step missing in the docs or some problem on my virtualenv

estebistec commented 10 years ago

You mean from this page [1]?

That page was generated from cookiecutter-pypackage and I don't usually use those directions. Let me try it from a fresh virtualenv and later today or tomorrow I'll make it more accurate.

In the meantime the simplest thing is to just pip install -r requirements.txt from the project folder in your virtualenv.

[1] http://drf-compound-fields.readthedocs.org/en/latest/contributing.html

expobrain commented 10 years ago

Yes, I followed those steps, especially:

$ mkvirtualenv drf_compound_fields $ pip install -r requirements.txt $ python setup.py test

estebistec commented 10 years ago

I added a missing dependency in setup.py and now the default instructions do work as-is.

I was able to just use requirements.txt before that fix and get passing tests, but this gets setup.py where it should be.