The context manager capability was added in
[https://github.com/django/django/commit/a678e9ea65 a678e9ea65] 10 years
ago. The count parameter was added in
[https://github.com/django/django/commit/17c18844561431aabed89c3bd48de951db7d13ab
#diff-7833da5b45a68d00834388d97dd5c4413e3796497c7bc5e0cc2621b08a2d0df1R543
17c188445] 8 years ago.
--
Ticket URL: <https://code.djangoproject.com/ticket/33400>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* stage: Unreviewed => Accepted
Comment:
Thanks for the report. Only `template_name` is used in
[https://docs.djangoproject.com/en/stable/topics/testing/tools/#django.test.SimpleTestCase.assertTemplateUsed
documented] calls, however it sounds reasonable to honor `msg_prefix` and
`count` when these methods are used as context managers.
Would you like to provide a patch?
--
Ticket URL: <https://code.djangoproject.com/ticket/33400#comment:1>
* cc: karyon (added)
Comment:
I could add a note to the documentation, but I don't have the capacity for
properly making this work, sorry.
--
Ticket URL: <https://code.djangoproject.com/ticket/33400#comment:2>
* owner: nobody => Ad Timmering
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/33400#comment:3>
* has_patch: 0 => 1
Comment:
Gave it a shot in [https://github.com/django/django/pull/15267 PR], in the
process aligning error messages to be for context manager use and direct
call use. Comments welcome and appreciated.
--
Ticket URL: <https://code.djangoproject.com/ticket/33400#comment:4>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/33400#comment:5>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"e700a3714fe668157e5f84ddabfd32d6aac08079" e700a37]:
{{{
#!CommitTicketReference repository=""
revision="e700a3714fe668157e5f84ddabfd32d6aac08079"
Refs #33400 -- Renamed SimpleTestCase._assert_template_used() to
_get_template_used().
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33400#comment:6>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"806efe912b846c1fde250c9321d8334b7517cd56" 806efe91]:
{{{
#!CommitTicketReference repository=""
revision="806efe912b846c1fde250c9321d8334b7517cd56"
Fixed #33400 -- Added support for msg_prefix and count arguments to
assertTemplateUsed()/assertTemplateNotUsed() used as context managers.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33400#comment:7>