Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

TemplatePanelTestCase fails under Django 1.5 #360

Closed
lucasicf opened this Issue Mar 14, 2013 · 3 comments

Comments

Projects
None yet
3 participants

This test is the only test which is failing on Django 1.5. I had to change the requirements on setup.py for running the tests:

tests_require=[
        'django>=1.3,<1.6',
],

This is the error message:

Traceback (most recent call last):
 File "/home/lucas/Projects/django-debug-toolbar/tests/tests.py", line 268, in test_queryset_hook
    self.assertIn('<<queryset of auth.User>>', ctx)
AssertionError: '<<queryset of auth.User>>' not found in "{'False': False, 'None': None, 'True': True}"

The point is: I suppose Django 1.5 has added this the support for True, False and None in the templates and this is passed in the context. Here is the patch in Django:
django/django@93240b7

printing template_panel.templates returns this with Django 1.4:

[{
    'signal': <django.dispatch.dispatcher.Signal object at [someaddress]>,
    'context': [
        "{'deep_queryset': '<<triggers database query>>',\n 'queryset': u'<<queryset of auth.User>>'}"
    ],
    'template': <django.template.base.Template object at [someaddress]>
}]

and this with Django 1.5:

[{
    'signal': <django.dispatch.dispatcher.Signal object at [someaddress]>,
    'context': [
        "{'False': False, 'None': None, 'True': True}",
        "{'deep_queryset': '<<triggers database query>>',\n 'queryset': '<<queryset of auth.User>>'}"
    ],
    'template': <django.template.base.Template object at [someaddress]>
}]

Since it checks for template_panel.templates[0]['context'][0], which returns the dictionary-string for the "False, None, True" thing, I believe the test can be changed to look for that strings in the whole context, not just the first position of the context.

Gesias commented Jun 12, 2013

Thanks!

Contributor

aaugustin commented Oct 15, 2013

Thanks for your contribution. In fact I fixed this issue yesterday with f4699b2.

Sorry I didn't notice your pull request. I'm new here and slowly going though the backlog of issues and pull requests.

@aaugustin aaugustin closed this Oct 15, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment