It's better to try the new import method first because in Django<1.9 the
old method is still available and will raise a RemovedInDjango19Warning
that we could have avoided.
In Python 2.7+, unittest *is* unittest2. We prefer this one. But in
Python 2.6, we can get skipIf from django.utils.unittest, provided
Django is 1.8 or older.
By the time the code here runs, it's too late to be modifying
base.BaseCommand.option_list; in fact doing so causes an OptionConflictError if
you later call another management command "recursively" while you're running
the first one.
We want to leave BaseCommand's option_list untouched (it's `()` by default in
Django 1.8+) in case the command we are wrapping has already upgraded to
argparse. BUT, if it hasn't, we'll get an OptionParser back, and can tack our
argument on at the last minute.
- Add `allow_failures` section for Django master on Travis.
- Django 1.9 is only supported on Python 2.7 and 3.4+.
- Only test main Python 2 and 3 with Django master.
This fixes the following failure:
ERROR: test_cache_url_value (tests.test_values.ValueTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "…/django-configurations/configurations/values.py", line 158, in to_python
return self._caster(value)
File "…/django-configurations/.tox/py34-dj18/lib/python3.4/site-packages/django_cache_url.py", line 98, in parse
config['LOCATION'] = "%s:%s:%s" % (url.hostname, url.port, db)
File "…/pyenv/3.4.3/lib/python3.4/urllib/parse.py", line 156, in port
port = int(port, 10)
ValueError: invalid literal for int() with base 10: 'port'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "…/django-configurations/tests/test_values.py", line 415, in test_cache_url_value
value = CacheURLValue(cache_url)
File "…/django-configurations/configurations/values.py", line 420, in __init__
self.default = self.to_python(self.default)
File "…/django-configurations/configurations/values.py", line 423, in to_python
value = super(DictBackendMixin, self).to_python(value)
File "…/django-configurations/configurations/values.py", line 160, in to_python
raise ValueError(self.message.format(value))
ValueError: Cannot interpret cache URL value 'redis://user@host:port/1'
----------------------------------------------------------------------
Ran 63 tests in 1.132s
FAILED (errors=1)
Allows value setting to work when checking if setting variable is within
a list, i.e: settings.database in ['default', 'other']
Signed-off-by: Jannis Leidel <jannis@leidel.info>