I'm trying to set up django-lean for my own project, and on a bare site,
the tests are failing.
My settings.py is here http://pastebin.com/vR5s3FCB
The test error I'm getting is
$ ./manage.py test experiments
Creating test database...
Creating table auth_permission
Creating table auth_group
Creating table auth_user
Creating table auth_message
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table django_admin_log
Creating table experiments_anonymousvisitor
Creating table experiments_goaltype
Creating table experiments_goalrecord
Creating table experiments_experiment
Creating table experiments_participant
Creating table experiments_dailyengagementreport
Creating table experiments_dailyconversionreport
Creating table experiments_dailyconversionreportgoaldata
Installing index for auth.Permission model
Installing index for auth.Message model
Installing index for admin.LogEntry model
Installing index for experiments.AnonymousVisitor model
Installing index for experiments.GoalRecord model
Installing index for experiments.Experiment model
Installing index for experiments.Participant model
Installing index for experiments.DailyEngagementReport model
Installing index for experiments.DailyConversionReport model
Installing index for experiments.DailyConversionReportGoalData model
......../usr/lib/python2.6/dist-packages/scipy/stats/stats.py:420:
DeprecationWarning: scipy.stats.mean is deprecated; please update your
code to use numpy.mean.
Please note that:
- numpy.mean axis argument defaults to None, not 0
- numpy.mean has a ddof argument to replace bias in a more general
manner.
scipy.stats.mean(a, bias=True) can be replaced by numpy.mean(x,
axis=0, ddof=1).
axis=0, ddof=1).""", DeprecationWarning)
........No handlers could be found for logger "experiments.loader"
.......F......
======================================================================
FAIL: testManageCommand (experiments.tests.test_management.TestManagement)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/usr/local/lib/python2.6/dist-packages/django_lean-0.2-py2.6.egg/experiments/tests/test_management.py",
line 40, in testManageCommand
experiment=self.experiment).count())
AssertionError: 5 != 0
----------------------------------------------------------------------
Ran 30 tests in 23.977s
FAILED (failures=1)
Destroying test database...
Looking at the code is telling me that it's failing after trying to do
update_experiment_reports.
I have no apps created/installed. I followed the Installation section
just after doing 'django-admin createproject X'.
I'm running this on an update Ubuntu 9.10 Karmic laptop.
Any advise?
Rory
The test should probably be modified to temporarily patch the settings
to define a dummy engagement function and then restore the previous
value.
Here is a snippet that we use in our production code.
@contextmanager
def patch(namespace, name, function):
"""Patches `namespace`.`name` with `function`."""
try:
original = getattr(namespace, name)
except AttributeError:
original = NotImplemented
try:
setattr(namespace, name, function)
yield
finally:
if original is NotImplemented:
delattr(namespace, name)
else:
setattr(namespace, name, original)
Then, in a test, we do:
from __future__ import with_statement
...
with patch(settings, 'NOTIFICATIONS_TRACEBACK', False):
# do some stuff in here
So I suggest adding the 'def patch' above into 'experiments/tests/
utils.py' and then wrapping the offending test case with:
with patch(settings, 'LEAN_ENGAGEMENT_CALCULATOR',
'experiments.testsettings.SimpleEngagementCalculator'):
That ought to do the trick. If it does, submit a pull request and I'll
merge it into the main repo and submit a new egg to PyPi nice and
fast.
Thanks,
Erik
On Mar 16, 10:35 am, Rory McCann <r...@technomancy.org> wrote:
> Hi all,
>
> I'm trying to set up django-lean for my own project, and on a bare site,
> the tests are failing.
>
> My settings.py is herehttp://pastebin.com/vR5s3FCB
> signature.asc
> < 1KViewDownload