Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
  • Loading branch information...
commit 68cfd446a3f3fd82cee85a1567ffbe7a8d1e3139 1 parent 3465a4f
Malcolm Tredinnick authored June 21, 2006

Showing 1 changed file with 4 additions and 4 deletions. Show diff stats Hide diff stats

  1. 8  tests/othertests/templates.py
8  tests/othertests/templates.py
@@ -538,27 +538,27 @@ def method(self):
538 538
 
539 539
     ### TIMESINCE TAG ##################################################
540 540
     # Default compare with datetime.now()
541  
-    'timesince01' : ('{{ a|timesince }}', {'a':datetime.now()}, '0 minutes'),
  541
+    'timesince01' : ('{{ a|timesince }}', {'a':datetime.now() + timedelta(minutes=-1)}, '1 minute'),
542 542
     'timesince02' : ('{{ a|timesince }}', {'a':(datetime.now() - timedelta(days=1))}, '1 day'),
543 543
     'timesince03' : ('{{ a|timesince }}', {'a':(datetime.now() -
544 544
         timedelta(hours=1, minutes=25))}, '1 hour, 25 minutes'),
545 545
 
546 546
     # Compare to a given parameter
547 547
     'timesince04' : ('{{ a|timesince:b }}', {'a':NOW + timedelta(days=2), 'b':NOW + timedelta(days=1)}, '1 day'),
548  
-    'timesince05' : ('{{ a|timesince:b }}', {'a':NOW + timedelta(days=2), 'b':NOW + timedelta(days=2)}, '0 minutes'),
  548
+    'timesince05' : ('{{ a|timesince:b }}', {'a':NOW + timedelta(days=2, minutes=1), 'b':NOW + timedelta(days=2)}, '1 minute'),
549 549
 
550 550
     # Check that timezone is respected
551 551
     'timesince06' : ('{{ a|timesince:b }}', {'a':NOW_tz + timedelta(hours=8), 'b':NOW_tz}, '8 hours'),
552 552
 
553 553
     ### TIMEUNTIL TAG ##################################################
554 554
     # Default compare with datetime.now()
555  
-    'timeuntil01' : ('{{ a|timeuntil }}', {'a':datetime.now()}, '0 minutes'),
  555
+    'timeuntil01' : ('{{ a|timeuntil }}', {'a':datetime.now() + timedelta(minutes=2)}, '2 minutes'),
556 556
     'timeuntil02' : ('{{ a|timeuntil }}', {'a':(datetime.now() + timedelta(days=1))}, '1 day'),
557 557
     'timeuntil03' : ('{{ a|timeuntil }}', {'a':(datetime.now() + timedelta(hours=8, minutes=10))}, '8 hours, 10 minutes'),
558 558
 
559 559
     # Compare to a given parameter
560 560
     'timeuntil04' : ('{{ a|timeuntil:b }}', {'a':NOW - timedelta(days=1), 'b':NOW - timedelta(days=2)}, '1 day'),
561  
-    'timeuntil05' : ('{{ a|timeuntil:b }}', {'a':NOW - timedelta(days=2), 'b':NOW - timedelta(days=2)}, '0 minutes'),
  561
+    'timeuntil05' : ('{{ a|timeuntil:b }}', {'a':NOW - timedelta(days=2), 'b':NOW - timedelta(days=2, minutes=1)}, '1 minute'),
562 562
 }
563 563
 
564 564
 def test_template_loader(template_name, template_dirs=None):

0 notes on commit 68cfd44

Please sign in to comment.
Something went wrong with that request. Please try again.