Opened 3 years ago

Closed 3 years ago

Last modified 2 years ago

#21598 closed Cleanup/optimization (fixed)

Cleanup template loader overrides in tests

Reported by: Unai Zalakain Owned by: Unai Zalakain
Component: Template system Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

A lot of tests in template_tests repeat a try finally block for overriding the template loader. This could be managed easily with contexts. django.test.utils.setup_test_template_loader makes use of a function base test template loader (which entered a deprecation timeline in 1.4) and together with django.test.utils.restore_template_loaders could also be managed as a context.

Change History (5)

comment:1 Changed 3 years ago by Unai Zalakain

Owner: changed from nobody to Unai Zalakain
Status: newassigned

comment:2 Changed 3 years ago by Unai Zalakain

Has patch: set

comment:3 Changed 3 years ago by Ramiro Morales

Triage Stage: UnreviewedAccepted

comment:4 Changed 3 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In 4dc4d12e27e4e0337568651136eee5b6f2171204:

Fixed #21598 -- cleaned up template loader overrides in tests

  • Template loader overriding is managed with contexts.
  • The test loader is a class (function based loaders entered deprecation timeline in 1.4).
  • Template loader overrider that overrides with test loader added.

comment:5 Changed 2 years ago by Aymeric Augustin <aymeric.augustin@…>

In cffa55908271bfbce9069b979ab150cd806c6d59:

Fixed regression in 4dc4d12e. Refs #21598.

That commit contained a mistake that resulted in the use_cached_loader
option of override_with_test_loader being ignored. As a consequence some
configurations weren't exercised any more by the test suite.

Note: See TracTickets for help on using tickets.
Back to Top