mirror of https://github.com/django/django.git
Fixed the "timeuntil" and "timesince" tests so that they don't fail on a
machine under heavy load. git-svn-id: http://code.djangoproject.com/svn/django/trunk@3188 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
3465a4f6f4
commit
68cfd446a3
|
@ -538,27 +538,27 @@ TEMPLATE_TESTS = {
|
||||||
|
|
||||||
### TIMESINCE TAG ##################################################
|
### TIMESINCE TAG ##################################################
|
||||||
# Default compare with datetime.now()
|
# Default compare with datetime.now()
|
||||||
'timesince01' : ('{{ a|timesince }}', {'a':datetime.now()}, '0 minutes'),
|
'timesince01' : ('{{ a|timesince }}', {'a':datetime.now() + timedelta(minutes=-1)}, '1 minute'),
|
||||||
'timesince02' : ('{{ a|timesince }}', {'a':(datetime.now() - timedelta(days=1))}, '1 day'),
|
'timesince02' : ('{{ a|timesince }}', {'a':(datetime.now() - timedelta(days=1))}, '1 day'),
|
||||||
'timesince03' : ('{{ a|timesince }}', {'a':(datetime.now() -
|
'timesince03' : ('{{ a|timesince }}', {'a':(datetime.now() -
|
||||||
timedelta(hours=1, minutes=25))}, '1 hour, 25 minutes'),
|
timedelta(hours=1, minutes=25))}, '1 hour, 25 minutes'),
|
||||||
|
|
||||||
# Compare to a given parameter
|
# Compare to a given parameter
|
||||||
'timesince04' : ('{{ a|timesince:b }}', {'a':NOW + timedelta(days=2), 'b':NOW + timedelta(days=1)}, '1 day'),
|
'timesince04' : ('{{ a|timesince:b }}', {'a':NOW + timedelta(days=2), 'b':NOW + timedelta(days=1)}, '1 day'),
|
||||||
'timesince05' : ('{{ a|timesince:b }}', {'a':NOW + timedelta(days=2), 'b':NOW + timedelta(days=2)}, '0 minutes'),
|
'timesince05' : ('{{ a|timesince:b }}', {'a':NOW + timedelta(days=2, minutes=1), 'b':NOW + timedelta(days=2)}, '1 minute'),
|
||||||
|
|
||||||
# Check that timezone is respected
|
# Check that timezone is respected
|
||||||
'timesince06' : ('{{ a|timesince:b }}', {'a':NOW_tz + timedelta(hours=8), 'b':NOW_tz}, '8 hours'),
|
'timesince06' : ('{{ a|timesince:b }}', {'a':NOW_tz + timedelta(hours=8), 'b':NOW_tz}, '8 hours'),
|
||||||
|
|
||||||
### TIMEUNTIL TAG ##################################################
|
### TIMEUNTIL TAG ##################################################
|
||||||
# Default compare with datetime.now()
|
# Default compare with datetime.now()
|
||||||
'timeuntil01' : ('{{ a|timeuntil }}', {'a':datetime.now()}, '0 minutes'),
|
'timeuntil01' : ('{{ a|timeuntil }}', {'a':datetime.now() + timedelta(minutes=2)}, '2 minutes'),
|
||||||
'timeuntil02' : ('{{ a|timeuntil }}', {'a':(datetime.now() + timedelta(days=1))}, '1 day'),
|
'timeuntil02' : ('{{ a|timeuntil }}', {'a':(datetime.now() + timedelta(days=1))}, '1 day'),
|
||||||
'timeuntil03' : ('{{ a|timeuntil }}', {'a':(datetime.now() + timedelta(hours=8, minutes=10))}, '8 hours, 10 minutes'),
|
'timeuntil03' : ('{{ a|timeuntil }}', {'a':(datetime.now() + timedelta(hours=8, minutes=10))}, '8 hours, 10 minutes'),
|
||||||
|
|
||||||
# Compare to a given parameter
|
# Compare to a given parameter
|
||||||
'timeuntil04' : ('{{ a|timeuntil:b }}', {'a':NOW - timedelta(days=1), 'b':NOW - timedelta(days=2)}, '1 day'),
|
'timeuntil04' : ('{{ a|timeuntil:b }}', {'a':NOW - timedelta(days=1), 'b':NOW - timedelta(days=2)}, '1 day'),
|
||||||
'timeuntil05' : ('{{ a|timeuntil:b }}', {'a':NOW - timedelta(days=2), 'b':NOW - timedelta(days=2)}, '0 minutes'),
|
'timeuntil05' : ('{{ a|timeuntil:b }}', {'a':NOW - timedelta(days=2), 'b':NOW - timedelta(days=2, minutes=1)}, '1 minute'),
|
||||||
}
|
}
|
||||||
|
|
||||||
def test_template_loader(template_name, template_dirs=None):
|
def test_template_loader(template_name, template_dirs=None):
|
||||||
|
|
Loading…
Reference in New Issue