Opened 10 years ago
Last modified 8 years ago
#23952 closed Cleanup/optimization
Don't run all template tests with string_if_invalid='INVALID' — at Version 2
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 )
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/utils.py
. 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 (2)
comment:1 by , 10 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 9 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.
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.