Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed the humanize tests to work properly with a pure-python datetime…

… module (platforms such as PyPy)

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17144 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit e71f33625c5979459e50644c700c04d8a27c4f4d 1 parent 8ddecc3
Alex Gaynor alex authored
Showing with 5 additions and 2 deletions.
  1. +5 −2 django/contrib/humanize/tests.py
7 django/contrib/humanize/tests.py
View
@@ -1,5 +1,7 @@
from __future__ import with_statement
+
import datetime
+import new
from django.template import Template, Context, defaultfilters
from django.test import TestCase
@@ -182,12 +184,13 @@ def now(self, tz=None):
from django.contrib.humanize.templatetags import humanize
from django.utils import timesince
orig_humanize_datetime = humanize.datetime
- orig_timesince_datetime = timesince.datetime.datetime
+ orig_timesince_datetime = timesince.datetime
humanize.datetime = MockDateTime
+ timesince.datetime = new.module("mock_datetime")
timesince.datetime.datetime = MockDateTime
try:
self.humanize_tester(test_list, result_list, 'naturaltime')
finally:
humanize.datetime = orig_humanize_datetime
- timesince.datetime.datetime = orig_timesince_datetime
+ timesince.datetime = orig_timesince_datetime
Please sign in to comment.
Something went wrong with that request. Please try again.