Feb 16

Getting Pinax 0.7.1 Tests To Succeed

In which I talk about my problems to get Pinax 0.7.1 to run it's tests without failing.

So I started using pinax, mostly just bootstrapping my project and for getting invitations and such running. However a bit of a problem is that with an out-of-the-box install of pinax there are lots of unit test failures.

Here's a run down of what I did with my social_project setup to clean that one up.

threadedcomments

I didn't bother to get the version included by pinax to succeed but used the new threadedcomments.

It's tests have a dependancy on Django==1.1, so at least for that you'll need that.

Otherwise install latest version from github, Tests will still fail, but after checking out the documentation we see how to fix that.

  1. Add django.contrib.comments to installed apps.
  2. Move comments/ in urlconf back from threadedcomments to contrib comments.
  3. Add COMMENTS_APP="threadedcomments" to your settings.

django_openid

Looks like the account.context_processor accesses the request.openid attribute which isn't set by the Mock consumers the openid tests use.

So remove the 'account.context_processor.openid' and add the following context processor:

def openid(request):
   return {'openid': getattr(request, "openid", None) }

Don't try this ...

if TEST_ENVIRONMENT:
         TEMPLATE_CONTEXT_PROCESSORS = ()
else:
         TEMPLATE_CONTEXT_PROCESSORS = ( ... your stuff ...)

Bite into the apple, upgrade django_openid and rewrite all context_processors that barf. That's the least hacky solution I came up with.

django-messages

This one is a bit funky, the tests can't never have worked as they I got them with Pinax 0.7.1.

Solution is easy peasy.

pip install -U django-messages

tribes, oembed

I just removed them ... tribes is easy to replace and not what I want anyway, OEmbed will need another look.

Finally it works...

Well mostly. There's a test in Django 1.1 which will fail with newer textile versions.
The failure itself isn't really a problem, as the difference in the tested output is added whitespace, which for HTML isn't an issue.

What bugged me about my approach is rewriting those context processors,
maybe, hopefully, there exists an approach that doesn't need this duplication.