﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
7487	Test Client's Response lacks context/template when using Doctests	DanielLindsley	Jacob	"When using 'django.test.client.Client' in conjunction with doctests, the response that comes back from the client will be without the 'context' or 'template' variables. This occurs because the 'template_rendered' signal doesn't seem to fire. The doctest code I am using is:

{{{
>>> from django.test import Client
>>> c = Client()

>>> r = c.get('/weather/')
>>> r.status_code
200

>>> r.context[-1]['station'].id
1
}}}

Without the attached patch, 'r.context' is set to None (via an else case - 'setattr(response, detail, None)' in the Client's request method).

The context/template variables are never set because the 'template_rendered' signal doesn't fire as it has not been imported, thus failing to be connected.  This only occurs when using doctests; unittests seem to act differently and aren't affected by this.  The attached diff works with both doctests & unittests.

This is not a duplicate of ticket #3051, as these tests are being run from both 'manage.py test' as well as 'manage.py shell'."		closed	Testing framework	dev		invalid			Accepted	1	0	0	0	0	0
