#12020 closed (invalid)
Template tests fail if they take longer than 60 seconds
| Reported by: | Jacob | Owned by: | Jacob |
|---|---|---|---|
| Component: | Template system | Version: | 1.1 |
| Severity: | Keywords: | ||
| Cc: | Triage Stage: | Accepted | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Many of the template tag/filter tests fail if the suite takes longer than 60 seconds to execute. That's because they do some stuff using times (e.g. asserting that {{ now }} == str(now)) that fails if now slips into the past.
This manifests itself as something like:
(django-trunk)jacob@dorkbook:~/Projects/Django/upstream/tests$ ./runtests.py --settings=testsettings.sqlite templates
======================================================================
FAIL: test_templates (regressiontests.templates.tests.Templates)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/jacob/Projects/Django/upstream/tests/regressiontests/templates/tests.py", line 262, in test_templates
('-'*70, ("\n%s\n" % ('-'*70)).join(failures)))
AssertionError: Tests failed:
----------------------------------------------------------------------
Template test (TEMPLATE_STRING_IF_INVALID=''): cache07 -- FAILED. Expected 'cache05', got u'cache07'
----------------------------------------------------------------------
Template test (TEMPLATE_STRING_IF_INVALID='INVALID'): cache07 -- FAILED. Expected 'cache05', got u'cache07'
----------------------------------------------------------------------
Template test (TEMPLATE_STRING_IF_INVALID=''): cache08 -- FAILED. Expected 'cache06', got u'cache08'
----------------------------------------------------------------------
Template test (TEMPLATE_STRING_IF_INVALID='INVALID'): cache08 -- FAILED. Expected 'cache06', got u'cache08'
----------------------------------------------------------------------
Template test (TEMPLATE_STRING_IF_INVALID=''): filter-timesince01 -- FAILED. Expected '1 minute', got u'2 minutes'
----------------------------------------------------------------------
Template test (TEMPLATE_STRING_IF_INVALID='INVALID'): filter-timesince01 -- FAILED. Expected '1 minute', got u'2 minutes'
----------------------------------------------------------------------
Template test (TEMPLATE_STRING_IF_INVALID=''): filter-timesince03 -- FAILED. Expected '1 hour, 25 minutes', got u'1 hour, 26 minutes'
----------------------------------------------------------------------
Template test (TEMPLATE_STRING_IF_INVALID='INVALID'): filter-timesince03 -- FAILED. Expected '1 hour, 25 minutes', got u'1 hour, 26 minutes'
----------------------------------------------------------------------
Template test (TEMPLATE_STRING_IF_INVALID=''): filter-timesince11 -- FAILED. Expected '0 minutes', got u'1 minute'
----------------------------------------------------------------------
Template test (TEMPLATE_STRING_IF_INVALID='INVALID'): filter-timesince11 -- FAILED. Expected '0 minutes', got u'1 minute'
----------------------------------------------------------------------
Template test (TEMPLATE_STRING_IF_INVALID=''): filter-timesince12 -- FAILED. Expected '0 minutes', got u'1 minute'
----------------------------------------------------------------------
Template test (TEMPLATE_STRING_IF_INVALID='INVALID'): filter-timesince12 -- FAILED. Expected '0 minutes', got u'1 minute'
----------------------------------------------------------------------
Template test (TEMPLATE_STRING_IF_INVALID=''): filter-timesince13 -- FAILED. Expected '0 minutes', got u'1 minute'
----------------------------------------------------------------------
Template test (TEMPLATE_STRING_IF_INVALID='INVALID'): filter-timesince13 -- FAILED. Expected '0 minutes', got u'1 minute'
----------------------------------------------------------------------
Template test (TEMPLATE_STRING_IF_INVALID=''): filter-timeuntil01 -- FAILED. Expected '2 minutes', got u'1 minute'
----------------------------------------------------------------------
Template test (TEMPLATE_STRING_IF_INVALID='INVALID'): filter-timeuntil01 -- FAILED. Expected '2 minutes', got u'1 minute'
----------------------------------------------------------------------
Template test (TEMPLATE_STRING_IF_INVALID=''): filter-timeuntil02 -- FAILED. Expected '1 day', got u'23 hours, 59 minutes'
----------------------------------------------------------------------
Template test (TEMPLATE_STRING_IF_INVALID='INVALID'): filter-timeuntil02 -- FAILED. Expected '1 day', got u'23 hours, 59 minutes'
----------------------------------------------------------------------
Template test (TEMPLATE_STRING_IF_INVALID=''): filter-timeuntil03 -- FAILED. Expected '8 hours, 10 minutes', got u'8 hours, 9 minutes'
----------------------------------------------------------------------
Template test (TEMPLATE_STRING_IF_INVALID='INVALID'): filter-timeuntil03 -- FAILED. Expected '8 hours, 10 minutes', got u'8 hours, 9 minutes'
----------------------------------------------------------------------
Ran 12 tests in 65.686s
FAILED (failures=1)
It's really freeking annoying.
Change History (3)
comment:1 by , 16 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:2 by , 16 years ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
On further inspection, this is actually not exactly the template tests' fault: turns out these tests only take this long when using the
file://CACHE_BACKEND. When doing so, the file cache backend is responsible for over 90% of the time spent running the template tests. When using a real cache backend the template tests take just over a second, which means that this issue is mostly moot.So I'm marking this invalid.
#11260 already is tracking the inefficiency of the file-based cache backend.