Re: [Django] #34823: assertTemplateUsed() context manager crashes for templates without names.

2023-09-22 Thread Django
#34823: assertTemplateUsed() context manager crashes for templates without 
names.
-+-
 Reporter:  Arian|Owner:  Arian
 Type:  Bug  |   Status:  closed
Component:  Testing framework|  Version:  4.2
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Mariusz Felisiak ):

 In [changeset:"7683c8635119b55eb04b18ab14b810582a4e8972" 7683c86]:
 {{{
 #!CommitTicketReference repository=""
 revision="7683c8635119b55eb04b18ab14b810582a4e8972"
 [5.0.x] Fixed #34823 -- Fixed assertTemplateUsed() context manager crash
 on unnamed templates.

 Backport of 51d703a27fee518491adee1e07e2b857a90b2c8d from main
 }}}

-- 
Ticket URL: 
Django 
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/0107018abc4915cb-cce14c45-c932-402b-87cf-32011fed62e6-00%40eu-central-1.amazonses.com.


Re: [Django] #34823: assertTemplateUsed() context manager crashes for templates without names.

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

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"51d703a27fee518491adee1e07e2b857a90b2c8d" 51d703a2]:
 {{{
 #!CommitTicketReference repository=""
 revision="51d703a27fee518491adee1e07e2b857a90b2c8d"
 Fixed #34823 -- Fixed assertTemplateUsed() context manager crash on
 unnamed templates.
 }}}

-- 
Ticket URL: 
Django 
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/0107018abc48bd88-ffc257a9-c25a-4ecb-84e3-46efd98e79c2-00%40eu-central-1.amazonses.com.


Re: [Django] #34823: assertTemplateUsed() context manager crashes for templates without names.

2023-09-22 Thread Django
#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:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * stage:  Accepted => Ready for checkin


-- 
Ticket URL: 
Django 
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/0107018abc16422b-566d7ad8-4326-49e3-a704-d9b2dc53639e-00%40eu-central-1.amazonses.com.


Re: [Django] #34823: assertTemplateUsed() context manager crashes for templates without names.

2023-09-20 Thread Django
#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:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+
Changes (by Arian):

 * needs_better_patch:  1 => 0
 * needs_tests:  1 => 0


Old description:

> When template_names includes at least one None type the string join will
> fail.
> This occurs when a rendered template does not define a name.
>
> {{{
> Traceback (most recent call last):
>   File "/home/.../admin-
> frontend/admin_frontend/admin_cash/tests/test_views.py", line 19, in
> test_get_context_data
> with self.assertTemplateUsed('admin_cash/bill_validator_logs.html'):
>   File "/home/../3.10/lib/python3.10/site-
> packages/django/test/testcases.py", line 146, in __exit__
> self.test()
>   File "/home/../3.10/lib/python3.10/site-
> packages/django/test/testcases.py", line 131, in test
> self.test_case._assert_template_used(
>   File "/home/../3.10/lib/python3.10/site-
> packages/django/test/testcases.py", line 828, in _assert_template_used
> % (template_name, ", ".join(template_names)),
> TypeError: sequence item 0: expected str instance, NoneType found
> }}}

New description:

 When template_names includes at least one None type the string join will
 fail.
 This occurs when a rendered template does not define a name.

 {{{
 Traceback (most recent call last):
   File "/home/.../admin-
 frontend/admin_frontend/admin_cash/tests/test_views.py", line 19, in
 test_get_context_data
 with self.assertTemplateUsed('admin_cash/bill_validator_logs.html'):
   File "/home/../3.10/lib/python3.10/site-
 packages/django/test/testcases.py", line 146, in __exit__
 self.test()
   File "/home/../3.10/lib/python3.10/site-
 packages/django/test/testcases.py", line 131, in test
 self.test_case._assert_template_used(
   File "/home/../3.10/lib/python3.10/site-
 packages/django/test/testcases.py", line 828, in _assert_template_used
 % (template_name, ", ".join(template_names)),
 TypeError: sequence item 0: expected str instance, NoneType found
 }}}

 [https://github.com/django/django/pull/17237 PR]

--

-- 
Ticket URL: 
Django 
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/0107018ab329bcb3-1a41d58e-eda3-48d6-abbb-546b026ebf57-00%40eu-central-1.amazonses.com.


Re: [Django] #34823: assertTemplateUsed() context manager crashes for templates without names. (was: _assert_template_used fails with anonymous templates)

2023-09-08 Thread Django
#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: 
Django 
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-00%40eu-central-1.amazonses.com.