It doesn't currently work in Django 1.10 due to the removal of the patterns function. I'm currently working on a PR.
Error with Django 1.10
$ mkvirtualenv django-experiments
$ pip install -r requirements.txt
$ python testrunner.py
Creating test database for alias 'default'...
EEE..EE..............................................................................
======================================================================
ERROR: test_permissions (experiments.tests.test_admin.AdminTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/kobold/django-experiments/experiments/tests/test_admin.py", line 55, in test_permissions
self.assertEqual(302, self.client.post(reverse('admin:experiment_admin_set_state'), {}).status_code)
File "/Users/kobold/.virtualenvs/django-experiments/lib/python2.7/site-packages/django/urls/base.py", line 60, in reverse
app_list = resolver.app_dict[ns]
File "/Users/kobold/.virtualenvs/django-experiments/lib/python2.7/site-packages/django/urls/resolvers.py", line 253, in app_dict
self._populate()
File "/Users/kobold/.virtualenvs/django-experiments/lib/python2.7/site-packages/django/urls/resolvers.py", line 193, in _populate
for pattern in reversed(self.url_patterns):
File "/Users/kobold/.virtualenvs/django-experiments/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Users/kobold/.virtualenvs/django-experiments/lib/python2.7/site-packages/django/urls/resolvers.py", line 310, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/Users/kobold/.virtualenvs/django-experiments/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Users/kobold/.virtualenvs/django-experiments/lib/python2.7/site-packages/django/urls/resolvers.py", line 303, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/Users/kobold/django-experiments/experiments/tests/urls.py", line 1, in <module>
from experiments.urls import urlpatterns
File "/Users/kobold/django-experiments/experiments/urls.py", line 1, in <module>
from django.conf.urls import patterns, url
ImportError: cannot import name patterns
======================================================================
ERROR: test_set_alternative (experiments.tests.test_admin.AdminTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/kobold/django-experiments/experiments/tests/test_admin.py", line 43, in test_set_alternative
response = self.client.post(reverse('admin:experiment_admin_set_alternative'), {
File "/Users/kobold/.virtualenvs/django-experiments/lib/python2.7/site-packages/django/urls/base.py", line 87, in reverse
raise NoReverseMatch("%s is not a registered namespace" % key)
NoReverseMatch: u'en-us' is not a registered namespace
======================================================================
ERROR: test_set_state (experiments.tests.test_admin.AdminTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/kobold/django-experiments/experiments/tests/test_admin.py", line 19, in test_set_state
response = self.client.post(reverse('admin:experiment_admin_set_state'), {
File "/Users/kobold/.virtualenvs/django-experiments/lib/python2.7/site-packages/django/urls/base.py", line 87, in reverse
raise NoReverseMatch("%s is not a registered namespace" % key)
NoReverseMatch: u'en-us' is not a registered namespace
======================================================================
ERROR: test_template_auto_create_off (experiments.tests.test_templatetags.ExperimentAutoCreateTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/kobold/.virtualenvs/django-experiments/lib/python2.7/site-packages/django/test/utils.py", line 208, in inner
return func(*args, **kwargs)
File "/Users/kobold/django-experiments/experiments/tests/test_templatetags.py", line 50, in test_template_auto_create_off
Template("{% load experiments %}{% experiment test_experiment control %}{% endexperiment %}").render(Context({'request': request}))
File "/Users/kobold/.virtualenvs/django-experiments/lib/python2.7/site-packages/django/template/base.py", line 184, in __init__
engine = Engine.get_default()
File "/Users/kobold/.virtualenvs/django-experiments/lib/python2.7/site-packages/django/utils/lru_cache.py", line 124, in wrapper
result = user_function(*args, **kwds)
File "/Users/kobold/.virtualenvs/django-experiments/lib/python2.7/site-packages/django/template/engine.py", line 81, in get_default
"No DjangoTemplates backend is configured.")
ImproperlyConfigured: No DjangoTemplates backend is configured.
======================================================================
ERROR: test_template_auto_create_on (experiments.tests.test_templatetags.ExperimentAutoCreateTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/kobold/django-experiments/experiments/tests/test_templatetags.py", line 56, in test_template_auto_create_on
Template("{% load experiments %}{% experiment test_experiment control %}{% endexperiment %}").render(Context({'request': request}))
File "/Users/kobold/.virtualenvs/django-experiments/lib/python2.7/site-packages/django/template/base.py", line 184, in __init__
engine = Engine.get_default()
File "/Users/kobold/.virtualenvs/django-experiments/lib/python2.7/site-packages/django/utils/lru_cache.py", line 124, in wrapper
result = user_function(*args, **kwds)
File "/Users/kobold/.virtualenvs/django-experiments/lib/python2.7/site-packages/django/template/engine.py", line 81, in get_default
"No DjangoTemplates backend is configured.")
ImproperlyConfigured: No DjangoTemplates backend is configured.
----------------------------------------------------------------------
Ran 85 tests in 0.909s
FAILED (errors=5)
Destroying test database for alias 'default'...
Great project, thanks!
It doesn't currently work in Django 1.10 due to the removal of the
patterns
function. I'm currently working on a PR.Error with Django 1.10