Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

TemplatePanelTestCase fails under Django 1.5 #360

Closed
lucasicf opened this Issue · 3 comments

3 participants

@lucasicf

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.

@lucasicf

Here is the proposed patch:

lucasicf@2a2082a

@Gesias

Thanks!

@aaugustin
Owner

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.