AttributeError: 'Settings' object has no attribute 'LEAN_ANALYTICS'

33 views
Skip to first unread message

Bryan

unread,
Aug 5, 2010, 1:02:21 PM8/5/10
to django-lean
I followed the instructions to set up django-lean:
http://bitbucket.org/akoha/django-lean/wiki/Home

When I attempted to run:
manage.py test experiments

All the tests failed with:
AttributeError: 'Settings' object has no attribute 'LEAN_ANALYTICS'


Are the installation instructions lacking a step?


Here is the trace route:

ERROR: testContingencyTableChiSquareValue
(django_lean.experiments.tests.test_significance.TestSignificance)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/Django-1.2.1-py2.7.egg/
django/test/testcases.py", line 256, in __call__
self._pre_setup()
File "/Users/Bryan/work/osqa/django_lean/experiments/tests/
utils.py", line 41, in _pre_setup
self.original_LEAN_ANALYTICS = settings.LEAN_ANALYTICS
File "/usr/local/lib/python2.7/site-packages/Django-1.2.1-py2.7.egg/
django/utils/functional.py", line 277, in __getattr__
return getattr(self._wrapped, name)
AttributeError: 'Settings' object has no attribute 'LEAN_ANALYTICS'

Erik Wright

unread,
Aug 15, 2010, 10:10:11 PM8/15/10
to django-lean
Hi Bryan,

That is a bug. The tests should still succeed without that setting.

If you wish to work around it, simply add "LEAN_ANALYTICS = []" to
your settings file.

A better solution is to modify experiments/tests/utils.py {TestCase}
to override __call__ and to use:

with patch(settings, 'LEAN_ANALYTICS', []):
super(TestCase, self).__call__(result)

Or else to extract some of the behaviour from patch (defined in that
file) so that it can be invoked from the _pre_setup and _post_teardown
methods.

I may take a look at it in the next week or two, but if anyone else
likes, feel free to submit a patch.

Cheers,

Erik
Reply all
Reply to author
Forward
0 new messages