summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2011-11-22 09:20:58 +0000
committerAlex Gaynor <alex.gaynor@gmail.com>2011-11-22 09:20:58 +0000
commite71f33625c5979459e50644c700c04d8a27c4f4d (patch)
tree3979fbedf64aa7c4b8bbc36b172af0e7772f3bd7
parent8ddecc39dbbb4da17a4eccff29bcf95efed991b8 (diff)
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
-rw-r--r--django/contrib/humanize/tests.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/django/contrib/humanize/tests.py b/django/contrib/humanize/tests.py
index 0217136b11..038709fe83 100644
--- a/django/contrib/humanize/tests.py
+++ b/django/contrib/humanize/tests.py
@@ -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 @@ class HumanizeTests(TestCase):
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