From e71f33625c5979459e50644c700c04d8a27c4f4d Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Tue, 22 Nov 2011 09:20:58 +0000 Subject: [PATCH] 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 --- django/contrib/humanize/tests.py | 7 +++++-- 1 file 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