#34823: assertTemplateUsed() context manager crashes for templates without 
names.
-----------------------------------+------------------------------------
     Reporter:  Arian              |                    Owner:  Arian
         Type:  Bug                |                   Status:  assigned
    Component:  Testing framework  |                  Version:  4.2
     Severity:  Normal             |               Resolution:
     Keywords:                     |             Triage Stage:  Accepted
    Has patch:  1                  |      Needs documentation:  0
  Needs tests:  1                  |  Patch needs improvement:  1
Easy pickings:  0                  |                    UI/UX:  0
-----------------------------------+------------------------------------
Changes (by Mariusz Felisiak):

 * status:  new => assigned
 * needs_better_patch:  0 => 1
 * needs_tests:  0 => 1
 * owner:  nobody => Arian
 * has_patch:  0 => 1
 * stage:  Unreviewed => Accepted


Comment:

 Thanks for the report, I was able to reproduce it with the following test:

 {{{!diff
 diff --git a/tests/test_utils/tests.py b/tests/test_utils/tests.py
 index cdb0453e44..b0eb0b0f83 100644
 --- a/tests/test_utils/tests.py
 +++ b/tests/test_utils/tests.py
 @@ -547,6 +547,12 @@ class
 AssertTemplateUsedContextManagerTests(SimpleTestCase):
              response = self.client.get("/test_utils/no_template_used/")
              self.assertTemplateUsed(response, "template_used/base.html")

 +        with self.assertRaisesMessage(
 +            AssertionError, "No templates used to render the response"
 +        ):
 +            with self.assertTemplateUsed("template_used/base.html"):
 +                self.client.get("/test_utils/no_template_used/")
 +
      def test_msg_prefix(self):
          msg_prefix = "Prefix"
          msg = f"{msg_prefix}: No templates used to render the response"

 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34823#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018a78762c37-e570ffa1-c8c0-4c61-9ff1-937d13f0568b-000000%40eu-central-1.amazonses.com.

Reply via email to