Opened 10 years ago

Closed 7 years ago

#23952 closed Cleanup/optimization (wontfix)

Don't run all template tests with string_if_invalid='INVALID'

Reported by: Tim Graham Owned by: nobody
Component: Template system Version: dev
Severity: Normal Keywords:
Cc: Preston Timmons Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Tim Graham)

After the template tests refactor in #23768, I don't think there's a need to run all the template tests with a different value of string_if_invalid (see template_tests/syntax_tests/ Instead of if self.engine.string_if_invalid: in a given test, we can add a second assertion to these tests and use self.settings(TEMPLATES={... string_if_invalid='INVALID' ...) and then render the template a second time.

Change History (3)

comment:1 by Aymeric Augustin, 10 years ago

Triage Stage: UnreviewedAccepted

I refactored the template engine into a library in order to be able to test it without depending on Django settings.

I'm now working to refactor the new individual tests to stop using Django settings.

Can you hold on for a few weeks?

Once I've merged my multiple template engines branch, we can re-evaluate refactoring opportunities in this area. Thanks.

comment:2 by Tim Graham, 8 years ago

Description: modified (diff)
Summary: Don't run all template tests with TEMPLATE_STRING_IF_INVALID='INVALID'Don't run all template tests with string_if_invalid='INVALID'

I updated the description to account for the TEMPLATE_STRING_IF_INVALID setting moving into TEMPLATES OPTIONS. The issue is still relevant although the fix may not look so nice since we'd have to override the TEMPLATES setting (list of dictionaries) instead of boolean setting.

comment:3 by Tim Graham, 7 years ago

Resolution: wontfix
Status: newclosed

Looks like there's about one or two tenths of a second of possible gain here. I don't think it's worth it.

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