* Refactor the documentation build process
Significant improvements:
* Allow easy isolated local builds via a dedicated Tox environment
* Configure Sphinx to use consistent packages and theme across local, CI,
and ReadTheDocs builds; local builds now look the same as the published
RTD pages
* Explicitly add a ReadTheDocs configuration as code, per their documented
best practices
* Remove lots of dead code and simplify the Sphinx configuration file
* Build docs in a dedicated CI step and enable stricter warning checking
* Fix docutils related build error.
* Relax Sphinx version.
* Invalidate RTD build cache.
* No need to combine coverage reporting I think.
* Add combining again.
Co-authored-by: Jannis Leidel <jannis@leidel.info>
Without this, using `configurations.setup()` after Django has been setup
already re-triggers the logging configuration, which then causes e.g.
pytest's caplog to not work anymore.
* Drop obsolete versions of Django from Travis tests
Django 1.8 reached EOL in April 2018.
Django 1.10 reached EOL in December 2017.
* Add support for testing Django 2.0 and 2.1 on Python 3.7
* Drop obsolete test (requires Django < 1.10)
- Drop django==1.9 as it reached end of life
- Drop python2.6, python3.3, and bring python3.6
- Bring django-2.0 in the matrix as expected failure until we add its
support
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.
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>
When assigning False to a BooleanValue and reusing it was raising a
ValueError exception because BooleanValue was evaluating False as None.
Thanks to @abbottc for catching this error.
- this enables a value to load from environment if the env variable name is given at construction time
- cache value of environment value now in property value
- add __new__ to allow a construction of a given type from environment directly. In this case now Value instance is constructed but an instance of the desired type that is covered by the Value implementation. For Value it is str, for DictValue it is dict etc.
- extend tests for this new behavior
- extend test coverage for some other places