Opened 22 months ago

Closed 17 months ago

Last modified 11 months ago

#21598 closed Cleanup/optimization (fixed)

Cleanup template loader overrides in tests

Reported by: unaizalakain Owned by: unaizalakain
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


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 22 months ago by unaizalakain

  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to unaizalakain
  • Patch needs improvement unset
  • Status changed from new to assigned

comment:2 Changed 22 months ago by unaizalakain

  • Has patch set

comment:3 Changed 22 months ago by ramiro

  • Triage Stage changed from Unreviewed to Accepted

comment:4 Changed 17 months ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

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 11 months 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